VCL – configuration for Magento and Varnish 3.0.2

cacheconfigurationmagentoreverse-proxyvarnish

I would like to kindly ask if there's someone who can help me configure Varnish for Magento
to reach far more hits. My current ratio from varnishstat is:

  1. cache_hit=271
  2. cache_miss=926

I'm kindly asking this because I've googled almost every site related to this theme, but 99.9% of configurations don't work because of outdated code.

Details of my set-up:

  • I use Varnish on port 80, Apache on port 81,
  • PageCache as Magento varnish module,
  • APC for PHP speed and Memcached for dynamic caching.
  • Load speed is about 1.5s on home-page (Pingdom.com average results) > USA ping & 2.5s > Europe.
  • Servers are located in Toronto, Canada.

EDIT:

This is my full VCL configuration > http://pastebin.com/885BzHCs
(I just use xxx.xxx.xxx.xxx for my IPs)
This is the info from the command (varnishtop -i TxHeader -I Cookie):

TxHeader Cookie: frontend=965b5...(*lots of numbers); adminhtml=3ae65...(*lots of numbers); EXTERNAL_NO_CACHE=1

"(*lots of numbers)" is just my adding to the info

Any idea how to avoid Varnish hitting this cookies? (If I got correctly the idea about avoiding Vanrish hitting the cookie and not caching the home page).

Thank you for any help!

Best Answer

I don't work with Magento, but here are some Varnish suggestions that have worked for me:

Check for Cookies

First, you should remove all cookies from hitting varnish, 'cos when varnish sees a cookie, it sends the request to the backend.

Use a command like this to see what cookies are being sent to the backend:

varnishtop -i TxHeader -I Cookie

vcl_hash

Second, evaluate if you really need vcl_hash. If you don't have a reason for using it, comment it out.

Try these one at a time and see if your hit ratio improves.

HTH, good luck.