Description of how caching works (using Edge)


(Tom Stringer) #1

We’ve always struggled to get a grip on how the various layers of caching operate in Matrix and how the numerous controls (cache manager, /_nocache, /_recache suffixes etc) affect those layers.

Our instances also now sit behind the Edge CDN which adds an additional layer to the whole thing.

Is there a document somewhere (or can someone provide something) that (relatively simply) explains the various layers, their purposes and which controls can be used to affect them?

I know this can get complicated pretty quickly, but it would be great to have something that describes how these things interact and can be manipluated. It sometimes feels like we’re fumbling around in the dark…


(Tbaatar) #2

This is an old article but still relevant:

Not sure how the Matrix CDN works but presumably it should work similarly to any other CDN such as CloudFront.


(Steven Kent) #3

It’d be nice to get an update from Squiz, just in case something’s changed in 8 years.


(Bart Banda) #4

Caching is always a tricky challenge.
We are working on some documentation currently that explains the different caching layers on a high level to help users understand it a bit more.

When it comes to Squiz Edge caching though, it is highly recommended to turn off Matrix caching all together for the site you are using Edge on, as this complicates things and sometimes makes the Edge cache not as effective.

Tom, if you are interested, you could contact your account manager at Squiz and see if we can share some internal detailed information we have on all the caching layers. It’s still in a draft mode but there might be bits of it they can share with you guys that are relevant to your situation.


(Tom Stringer) #5

Thanks Bart, that’d be helpful.

We’ve had numerous conversations over the years, but it always seems to bounce off.

Would be great if there was a relatively simple overview available in the manuals that describes (at a high level) what the various caching layers are called, what their main purposes are and how they can/should/shouldn’t be used.

The article that @tbaatar pointed us towards above is handy for some initial settings, but it’s not quite as manually as we’d like (if that makes sense).


(Douglas (@finnatic at @waikato)) #6

Perhaps expanding the scope here, but a clear “here’s how your Matrix system should be setup with caching headers” document covering likely scenarios (apache or nginx and/or varnish out front, squiz edge or other mainstream CDN) would be really useful as a reference for best practice setup of Matrix.


(Tom Stringer) #7

Following up on this one from a while back @Bart

You mentioned that you were working on some documentation?

We’ve been trying to piece together our own internal documentation for how to manage cache headers, but it’s very opaque and we’re not at all confident it’s right.

For example, is it right that the “Browser Cache Expiry” setting (in “Root Node Cache Management”) has no effect if we’re behind Edge?


(Bart Banda) #8

Hey Tom,
Unfortunately we have not got the chance to properly do this yet. We are hiring a new tech writer for Matrix currently so I’m hoping this is something they can tackle shortly after they start.

Yes it does. Edge will look at that header and cache it for that amount of time, as Edge acts as the “Browser” in this case. However, if you also set “Accelerator Cache Expiry”, it will use that instead because Edge is considered the “Accelerator Cache” as well. So it will use Accelerator if it’s there, if it’s not, it will default down to “Browser”.

Hope that makes sense and helps.