2
votes

we have some strange problems with (nginx), magento(1.9.0.1), turpentine and varnish(3.0.2), running on Ubuntu 12.04lts. We aren't 2 experienced with varnish/turpentine, so this might be a basic thing.

We got the turpentine vcl successfully applied to the running varnish instance, and checked the result with varnishadm vcl.list. We also enabled debug info in turpentine.

Strange thing:

If we activate both turpentine caching methods in magento backend->cache, especially the fpc, we got the following response

Server  nginx
Transfer-Encoding   chunked
Via 1.1 varnish
X-Frame-Options SAMEORIGIN
X-Powered-By    PHP/5.3.10-1ubuntu3.15
X-Turpentine-Cache  0
X-Turpentine-Esi    1
X-Varnish   293774805
X-Varnish-Hits  0

and a real bad response time of 3.5sec cause the page never seems to get cached as you can see clearly in X-Turpentine-Cache and X-Varnish-Hits. There's also no age set in header.

But if we deactivate the turpentine fpc, while letting the vcl untouched we get

Age 29
Server  nginx
Via 1.1 varnish
X-Frame-Options SAMEORIGIN
X-Powered-By    PHP/5.3.10-1ubuntu3.15
X-Varnish   293775151 293775096
X-Varnish-Hits  2

combined with the optimized resonse time about 100ms, this seems to be a hit.

What point are we missing to setup turpentine/varnish the right way, what is causing the zero hit rate with activated turpentine caching?

Thanks in advance...

1
Did you enable all caches in Mageto?kuba_ceg
Yes, all internal ones. I disabled memcached etc.gewaechshaus
And of course there's no other external fullpagecache running...gewaechshaus
"Server nginx" in both headers makes me think something is wrong with your configuration. i dont see a full picture, so this question is only guessing.ADM

1 Answers

3
votes

Here's some steps to troubleshoot:

Get Varnish Working on its own:

Your varnishd should be running with several parameters, here's samples from my Ubuntu Server install (/etc/defaults/varnish):

  • -a :6081 public port -- this is the port webbrowsers will use
  • -T localhost:6082 admin port -- this is used to configure varnish
  • -f /etc/varnish/default.vcl initial VCL config file (see below) -- the configuration used when varnish first starts
  • -s malloc,256m storage backend -- a 256MB in-memory backend in this case
  • -S /etc/varnish/secret path to varnish's admin password file

Turpentine's documentation also mentions these parameters are likely required:

  • -p esi_syntax=0x2
  • -p cli_buffer=16384

Here's my sample default.vcl, this is a barebones config that tells Varnish to proxy requests to 127.0.0.1:80, and wil only be used until Turpentine reconfigures Varnish:

backend default {
    .host = "127.0.0.1";
    .port = "80";
}

You can verify these settings are in-use by checking the running process: ps aux |grep varnishd

Testing your Varnish config

With varnishd running with the above parameters you should be able to telnet to your admin port (-T above):

telnet localhost 6082

If you provided -S above you will be prompted for authorization; use the contents of your secret file. If you can't get in via telnet try removing the -S parameter to disable authentication (you'll want to re-enabled it later). Once you login you'll be at the varnish console; keep this open.

Setting up Turpentine

I assume you've successfully installed Turpentine in Magento. Go to System -> Configuration and review these settings:

  • Varnish Options

    • Varnish Version: Set to "Auto" if you don't know the specific version you're using
    • Server List: this should exactly match the -T parameter for varnishd -- localhost:6082 in the above example
    • Varnish Authentication Key: this should be the key used for -S above, or empty if you've disabled authentication
  • Caching Options

    • Backend Host: localhost if Magento and Varnish are on the same server, otherwise the Magento host
    • Backend Port: Magento's HTTP port (typically 80)

When you save these configs you should see a success or error message. This message indicates that Turpentine was able to generate a new VCL configuration file and make it active in Varnish. To confirm this use your telnet session to run vcl.list. You should see something like:

vcl.list
200 106     
available       4 boot
active          2 ef1a15f2132a599ed26520c94c599e71aa7f5e576afcfca211e6249dcd640ddd

boot is the default.vcl above; the second VCL is what Turpentine has generated and has been switched to be active.

  • Use System -> Cache Management to enable both Varnish Magento caches; flush all caches and logout of the admin panel to ensure everything takes effect.

At this point Turpentine should be up and running. You can run varnishstats and load your webpage using the -a port from varnishd. Reloading the page several times should result in an above-zero Hitrate.

Keep in mind that with this configuration your Turpentine VCL will be lost if varnishd is restarted (along with cached contents). You can use the Cache Management page of magento to export a new .acl file to use for the -f parameter so that it will take effect whenever varnish restarts.