Guide to Caching

Description

Caching strategies to improve performance.

This guide particularly focuses on Unix-like environments, though the stack discussion may be useful to everyone.

Any dynamically generated website with a non-trivial number of visitors, will benefit from caching, where resources (like text, images, CSS, javascripts) that are used for multiple visitors are stored in a way that is really fast to retrieve, so that the (often complicated) back-end server doesn't have to generate those resources for every visitor.

Plone is no exception to that. Caching in Plone is a two-step process for most larger sites. There is an add-on called plone.app.caching that is shipped with Plone since version 4.1. On its own, it will already speed up response time quite dramatically. You simply have to enable it, use the default values provided, and you will have a faster site.

You can also tweak the settings to get better performance. There is always a little trade-off to be made here, so-called 'strong' caching will be faster, but it may mean that visitors get older content. So, it is usually best to set up 'strong' caching for things that don't change often, like CSS and javascript files, and 'weak' caching for actual texts. You can also 'invalidate' content automatically when you update a piece of content, so that the front-end server knows it has to get a fresh copy when you edit a piece of content.

But plone.app.caching works even better together with a dedicated front-end cache, a program that is specialized in doing this work. These days, the favourite and recommended program for that is called "Varnish".

Here, you will find documentation on both. Remember, they work best together.