/
Pack Hosting Panel

Soft purge

How to "soft purge" Varnish cache


Introduction

Traditionally when a Varnish object or page gets purged the next user request will rebuild a new cache. Thus resulting in a slow user request. When looking at high traffic websites it gets even worse. Not only one user will have a slow request but if the page that gets refreshed is accessed by 10 users during the cache build time we get 10 slow request.

Alternatively we can also configure Varnish to soft purge the page. Then instead of purging the page directly we allow Varnish to serve stale cache while Varnish fetches the new page from the backend. Now all your users will receive a cached page.

Varnish changes

All Hipex servers will have the vmod_xkey module installed so all we need to do is a few changes to the varnish vcl.

All done!

References