Recent observations indicate two main issues with our Varnish cache:
- Unpredictable cache coverage: Why is it that some pages are served from cache and others aren't? What exactly is cached? Under what conditions are things that were cached dropped?
- Different cache responses from different slaves: Refreshing the screen repeatedly can 'toggle' between two different versions of the truth
A suggested process to improve the performance of Varnish includes:
- Understand how Varnish is currently working
- Identify improvements
- Prioritise the improvements
- Implement the highest priority
- Remeasure performance
- Return to step 4
Understand how Varnish is currently working
Answering the following questions will enrich our understanding of Varnish
- What version of Varnish are we running? Maybe also the versions of the other components on each slave?
- What are the machine/server specifications/resources?
- How are the two instances syncing?
- What are the exact rules/settings that are enabled or in place?
- What is being cached? Images? Video? PDF? Search results?
- With what conditions?
- Once a piece of content has been cached in Varnish, under what conditions does it drop out of the cache or requested again from Squiz?
- How long does a cached resource stay in the cache?
- How does Varnish treat Squiz's HTTP header? For example, does anybody know why the standard headers I see in the console have an "Cache-control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0" and "Expires:Thu, 29 Apr 1982 00:00:00 GMT"