← Back to context

Comment by kevincox

3 days ago

One major issue with Vary is that it makes cache coalescing very complicated. This is because you can't know whether two requests will share a response until you get that response. So for subsequent requests you need to decide if you should block it hoping that the response will satisfy it or if you should send it through pessimistically, possibly triggering a thundering herd effect on every cache rotation.

I'm not sure if it is possible to solve this nicely in a generic way, but it does make it a bit ugly.

This is not caused by Vary but by the app being so.. variable.

If you segregate content-type/language by end-point then the variability goes away. But now you have a plethora of end-points. The complexity can get moved around, and in this particular case the complexity for the caching layer can be removed, but the complexity isn't gone.