I’m very excited about two extensions for the classic Squid proxy: stale-while-revalidate and stale-if-error.
There’s a great writeup on Igvita, along with sample rack application to implement the same.
No CommentsBoth stale-while-revalidate and stale-if-error are the direct results of Mark Nottingham’s work at Yahoo. It is clear that Squid plays a big role in the Y! infrastructure and these extensions are undoubtedly deployed in their data centers. Stale-while-revalidate addresses a simple problem: when a record becomes stale, instead of allowing the request to hit the application server, serve the stale data to the client and create an asynchronous request to update the cache (read more & spec). The benefit? All of your customers see consistent performance because the data is always served out of the cache (think RSS feeds, search results, etc).
The second extension (stale-if-error) can help you mask downtime by returning stale data while your ops team resolves the problem. How does it work? You specify a cache-control header (Cache-Control: max-age=600, stale-if-error=1200) which indicates for how long, after the record is expired the cache server can serve this data if the application server is down. Of course, nothing stops you from setting this to a high value like a day or longer! This way, if your server goes down, at least the clients won’t timeout on their requests while you’re resolving the problem!


0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.