One of the most frequently asked questions we receive at Savvii is: what are the best W3 Total Cache settings to contribute to more speed in addition to the measures already taken by Savvii?Interested in finding out the proper settings? Then continue reading this article.
The best W3 Total Cache settings
Caching is one of the tools we use at Savvii to increase to speed of our customers website’s. We do this for entire web pages with Varnish proxy caching in all available hosting-plans. Our VPS-plans offers an additional XCache opcode caching and memcached object caching.
We won’t discuss all the options in this article but only those that are relevant for our customers.
An important piece of advice for the best W3 Total Cache settings is to let W3 Total Cache (W3TC) only manage and cache things that Savvii can’t control on a higher level in the stack.
Unfortunately, the plugin is not very user friendly because you have to make adjustments on 2 separate locations for each item: general settings and the specific settings pages.
We recommend you first run a few test on webpagetest.org so you have a so called ‘zero or baseline measurement’ before any changes are made. After each change you can then test the effects of the W3TC on the first-byte-time and total loading time of your website.
The effects may differ depending on your site and W3TC won’t always make your site faster.
Page Cache stores the ready-to-use HTML of your page and shows it to your customers. This means that many PHP functions and database queries no longer need to be executed.
Page cache could normally be disabled because Varnish already does the same, but faster. Only enable page cache in case your website runs on HTTPS. Because in that case Varnish can’t cache.
If your websites happens to run on HTTPS, then choose ‘Disk: Enhanced’ for our shared-plans and ‘Memcached’ for our VPS-plans. The address for memcaching at Savvii VPS’s is: 127.0.0.1:11211.
Combine ensures that multiple CSS and JS files are merged into one CSS and / or JS file. Besides the fact that this allows you to send less data, it is also faster to send one single file than several files with the same total size.
Minify can be dangerous and break your website so be sure to test this thoroughly, both the effect on the site itself and its loading time. Never Minify your HTML, this isn’t nessecary because at Savvii we already use gzip to reduce the size of HTML assets. This is why we only recommend Combine for minifying your CSS and JS. You should use the default minifiers.
Database caching can be very useful if simply caching your pages isn’t possible (i.e. webshops or other session based content). It can however slow down your site if the caching is done from the harddisk.
In shared packages you can use the “Disk” setting and for VPS’s you should choose “Memcached”. Never cache queries for user who are logged into your website. Optimal lifetime for cached object can vary per site, we use 3600 seconds. The higher the number of visitors to your site the shorter you can set the lifetime for the caching because the requests will still be queried often enough by the visitors to be cached. If you have a low number of visitors a higher lifetime will suit your site better since request will be cached longer.
Same as before, you should test the effects of database caching once its been enabled
For object caching the shared packages can use the “Disk” option and for VPS packages you can use the “Memcached” option. The adres for memcaching is the same as before: 127.0.0.1:11211 . Optimal lifetime for cached object can again vary per site, we usually use 3600 seconds. Again the higher the number of visitors to your site the shorter you can set the lifetime for the caching.
For object caching the same goes as before, test the speed of your site before and after changes are made to see what works best for your website.
You shouldn’t use the option at all! Options like gzip compression and putting cache-control headers is something that we manage at a higher level in the stack. Activating HTTP compression (gzip) again can cause problems.
User-agent and Referrer Groups
You can use these options to alter the caching behaviour for specific kinds of visitors, for instance plugins which deploy different assets based on the visitors device (i.e. mobile vs desktop site). If you think this is relevant for you, please contact us for advice!
If you use the Savvii CDN then you can leave the W3TC CDN disabled.
Are you satisfied with your settings? Then you may want to consider exporting your configuration. You can do this at the bottom of the general settings page. You can import the same settings for a different site. But as before, testing is important for every site and every change made.
Are you interested in optimising your configuration to your specific needs? Or want to have a talk about the best W3 Total Cache settings? Feel free to contact us!