Micro-caching and Nginx can really speed up the app.
Would it be possible to use micro-caching (or something similar) with Varnish?
Micro-caching and Nginx can really speed up the app. Would it be possible to
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes you can set Varnish to micro-cache content.
For other readers, micro-caching is a transparent process where a cache keeps a local of copy of content that is not to be cached, and serves that for a specified time.
For example, you may have a home page the updates often, and have no caching set in the headers for the site. However your application is running on a VM that is low performance, and it cannot cope with many requests. Micro-caching can mitigate this problem by silently serving the home page from cache (and sending no headers) for a short time.
In Varnish this is achieved with the TTL setting. This tells varnish to cache the content for the time specified.
If you are using TTL you should also use the GRACE setting – this tells varnish to continue to serve cached content for a specified time should the backend not respond in a timely manner.
The other advantage with TTL (the default is, I believe, 120 seconds) is that varnish sends only the first request for uncached content to the backend, queuing any other requests to wait for the cache to be ready.
The Varnish Book has some examples of what is possible with various settings of grace and ttl.