Welcome to chapter 8 where we will focus on decision-making on the edge.
Varnish is more than a take-it-or-leave-it cache. Most Varnish implementations focus on caching as much as possible, using VCL to explicitly include content, and exclude content that is not cacheable. The take-it part refers to cacheable content, the leave-it part to non-cacheable content.
Despite good hit rates and acceptable performance at a large scale, the non-cacheable content can still be a weak spot.
The reasons why certain content cannot be cached can sometimes be quite trivial:
By leveraging VMODs and bypassing built-in VCL logic, it is entirely possible to cache otherwise uncacheable content.
Varnish can act as an authentication gateway; Varnish can serve personalized content without creating too many cache variations; Varnish can even interact with third-party systems to feed the cache with external data.
Let’s write some VCL to do more on the edge and to increase our hit rate.