Score:0

How to force Varnish stale whole content

ai flag

We have a website which is fairly large. we update content every week but it is fine to serve stale for the first visit after updating backend content. Therefore we dont want to ban or purge whole cached content in varnish which make whole websites slowly for the first visit. So is there anyway to tell Varnish to stale whole cached content without clearing them already until someone visit and Varnish will fetch content in background?

Edited : I read about BAN command in Varnish however the document doesn't write it very clearly. I'm not sure if the cached content will be marked as stale and Varnish will still serve it for the first visit while fetching fresh content from backend or Varnish will force waiting for new fresh content from backend for the first visit ?

Score:0
cn flag

You're literally talking about grace mode:

Setting an object’s grace to a positive value tells Varnish that it should serve the object to clients for some time after the TTL has expired, while Varnish fetches a new version of the object.

Tung avatar
ai flag
Not really, I know this grace mode however lets assume we have Varnish with cached content with very long TTL already. Now I have fresh content in backend which I want Varnish to fetch. However I don't want to remove cached content which make the website slow, I want to tell Varnish to stale content only so first visit still get staled content from Varnish while Varnish fetch fresh content from backend asynchronously.
cn flag
Then you're talking about [`softpurge`](https://varnish-cache.org/docs/7.1/reference/vmod_purge.html#purge-soft).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.