August 31, 2021
2 min read time

How to Get Away with Website Downtime Without Anyone Knowing

Downtime is always bad, and you want to avoid it. But sometimes you can get away with it. This is one of the magic things about content caching and being able to serve stale content. You can avoid the perception of downtime (to some extent) and give your website the appearance of being up and running at full speed, even when your backend is down.

Failure is inevitable: Cache for perceived uptime

Sometimes all servers fail and you only have your cache and the content in it to keep you going. You need a good caching strategy in place, and of course, to be able to give the appearance of all-systems-go uptime all the time, you need to keep your cache populated. Not all of your assets will be in cache. But at least the most popular content will be, and it won’t matter if your backend is down. You won’t necessarily be sharing the freshest, most current version of the content, but it’s better to serve something stale than to serve an error.

Don’t bail on stale content

In Varnish, stale content can still be good content. With the stale VMOD, you can implement stale-if-error behavior in Varnish, which basically allows you to never serve outdated content, except when the backend is down (or when your backends are struggling). You just need to use Varnish Configuration Language (VCL) to make sure the object does not exit the cache when it expires. 

You can use VCL to make sure that a cached object does not go away when it expires/its time to live (TTL) ends. This configuration won’t kick in if operations are normal, but your VCL will jump into action, reviving stale content, when a backend goes down.

There’s a lot more functionality and complexity to protecting the illusion of uptime and continuing to serve content even in failure and outage conditions. 

If you’re ready to learn more, watch the webinar.

 

New call-to-action