8 June 2016

Magento Varnish how to - part three


Part Three


Welcome back once again to the third and final part of this Magento Varnish mini series.  The first part discussed why you should be using Varnish on your store, the second part showed you some figures for the kind of performance benefit a Magento Varnish cache is likely to give, and this final part shows you just how straight forward it is to actually get a Magento Varnish cache up and running on your store by using the easy integration offered by Evolved Caching.

How do I setup a Magento Varnish cache?

 

Varnish cache can be a complex piece of software to setup and customise to your exact site requirements with the default configuration it ships with catering for some, but certainly nothing like all sites.  As discussed in part one of this series, it basically won't cache Magento's pages at all while running it's default configuration and so needs some work to allow it to cache correctly.

That's where Evolved Caching comes in.  While Evolved Caching is a highly performance driven, advanced Magento full page caching solution in it's own right, it also massively simplifies using Varnish to cache your store pages by way of it's caching key cookie.  This cookie contains a unique reference describing everything about each page, including data that is normally stored in the session.  The cookie is delivered to Varnish for every request, and so rather than caching only by URL - which is extremely limiting in the case of Magento, Varnish can then cache the full breadth of possible page variations Magento can generate, and this includes caching pages when products are in the cart, or the customer is logged in.

Evolved Caching takes care of everything related to adding dynamic content to the page, defining which pages should be cached (or not) and allows Varnish to just get on the with the job of serving super fast cached content.  You can also manage the Varnish cache from within admin including automatic cache clearing and warming of pages as they are updated.  Evolved Caching does all the hard work for you!

So how can you get a Magento Varnish cache for your store?  This is how to do it.

The easy integration is given by Evolved Caching so as a starting point you can grab your copy here and follow the quick setup guide to get running with that.  You also need a clean, unmodified install of Varnish and you can find full instructions here.

Once you have these basic requirements in place there are just three simple steps you need to follow to get your Magento Varnish cache.
  1. Use our vcl configuration file for either Varnish 4 or Varnish 3 in /etc/varnish/default.vcl on your server.
  2. Enable 'flush varnish cache' under the general options section of the Evolved Caching settings.
  3. Turn on 'enable cookie' under the caching key cookie section of the Evolved Caching settings.
That's it!

Now you just need to restart Varnish, and clear the Magento cache (including the Evolved Caching cache) and you should see Varnish serving cached content as you navigate the site.  the Varnish cache will also be cleared and populated as you use admin.  If you are not sure how to tell if Varnish is serving cache or not have a look at the bottom of our Evolved Caching Varnish documentation page.

Thanks for reading this mini series, we hope you find your Magento Varnish cache gives your store a real performance boost!

No comments:

Post a comment