3

I've installed Varnish Turpintine on our staging site by following the instructions on the Magento-Turpintine wiki.

Our site is on Ubuntu 14.04, NGINX, varnish-4.0.3m, Turpentine v0.6.5, Magento 1.9.2.

These are my DAEMON_OPTS in /etc/default/varnish

DAEMON_OPTS="-a :80 \
             -T localhost:6082 \
             -f /etc/varnish/default.vcl \
             -S /etc/varnish/secret \
             -p cli_buffer=16384 \
             -p feature=+esi_ignore_other_elements \
             -p vcc_allow_inline_c=on \
             -s malloc,256m"

I installed the turpentine module successfully, only really changing the config for the Secret Varnish Authentication Key with the \n appended, URL Blacklist and enabling debug info.

When I tried saving my configuration I got the bellow error:

Failed to apply the VCL to 127.0.0.1:6082: Got unexpected response code from Varnish: 106 Message from VCC-compiler: directors are now in directors VMOD. ('input' Line 27 Pos 1) director default round-robin { ########---------------------- Running VCC-compiler failed, exited with 2 VCL compilation failed

This is what I have in the Turpentine generate var/default.vcl file:

vcl 4.0;
C{
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <pthread.h>
static pthread_mutex_t lrand_mutex = PTHREAD_MUTEX_INITIALIZER;
void generate_uuid(char* buf) {
pthread_mutex_lock(&lrand_mutex);
long a = lrand48();
long b = lrand48();
long c = lrand48();
long d = lrand48();
pthread_mutex_unlock(&lrand_mutex);
sprintf(buf, "frontend=%08lx%04lx%04lx%04lx%04lx%08lx",
a,
b & 0xffff,
(b & ((long)0x0fff0000) >> 16) | 0x4000,
(c & 0x0fff) | 0x8000,
(c & (long)0xffff0000) >> 16,
d
);
return;
}
}C
import std;
director default round-robin {
{
.backend = {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 300s;
.between_bytes_timeout = 300s;
}
}
}
director admin round-robin {
{
.backend = {
.host = "127.0.0.1";
.port = "8080";
.first_byte_timeout = 21600s;
.between_bytes_timeout = 21600s;
}
}

I was seemingly able to fix this by creating the custom_include.vcl file from version-4.vcl as it was missing

cp app/code/community/Nexcessnet/Turpentine/misc/version-4.vcl app/code/community/Nexcessnet/Turpentine/misc/custom_include.vcl

But now when I try to save the configuration I get a new error:

Failed to apply the VCL to 127.0.0.1:6082: Varnish data to write over length limit by 749 characters

This seems to be related to the -p cli_buffer=16384 which I set in the DAEMON_OPTS at /etc/default/varnish. When I try increasing this I still get the same error but with a different limit.

Failed to apply the VCL to 127.0.0.1:6082: Varnish data to write over length limit by 8941 characters.

I have nothing in magento/var/log/ or /var/log/varnish/ for Varnish. I tried chacking the Varnish Admin to see if there was anything wrong with the cli_buffer but could see nothing of note.

$ sudo varnishadm
varnish> param.show cli_buffer
200        
cli_buffer
        Value is: 16k [bytes]
        Default is: 8k
        Minimum is: 4k

        Size of buffer for CLI command input.
        You may need to increase this if you have big VCL files and use
        the vcl.inline CLI command.
        NB: Must be specified with -p to have effect.

Thanks in advance for any advice suggestions.

2 Answers 2

2

Thanks for sharing. I just installed the latest version from the devel branch to fix a very similar problem. To check if Varnish is caching you could use either of the following varnishtop commands, if you have access to the server.

/usr/bin/varnishtop -i RxURL
/usr/bin/varnishtop -i RxHeader -C -I \^HOST
2
  • both say something like -i: "RxURL" matches zero tags. Does this mean it's not working? Do you know what varnishtop -i is doing? when i run varnishtop on it's own without the -i flag I get a lot of info
    – Holly
    Commented Sep 11, 2015 at 16:14
  • Not sure, I always got out with either of them when browsing the site. Commented Sep 11, 2015 at 20:27
1

I seem to have gotten this working by applying a fix I found of GitHub ticket 915.

First off the fix I applied for my first error was misleading so I removed the file I created.

rm app/code/community/Nexcessnet/Turpentine/misc/custom_include.vcl

Then I merged the devel branch of the Magento-Turpintine repo with my Magento project as suggested in the GitHub Ticket 915.

Now when I save the Turpintine Config / apply the Varnish config I got no error messages.

Although the site does not seem to have sped up a great deal, how can I ensure varnish is working as it is supposed to.

UPDATE I was able to ensure Varnish was working by running varnishstat, if the Hitrate avg is greater than 0 it means the cache is being hit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.