Categories
Server Administration Web Architecture

Caching strategy – Using varnish to handle high traffic

Varnish is an HTTP accelerator and is used as a caching strategy to reduce load on web server… you can find great guides on how to set it up and get started.But the more elusive question is WHEN TO USE VARNISH?

Trying to streamline the caching strategy, we often had to rethink when to use Varnish. My estimation is that one should use the below checklist to decide on a caching strategy & if or not to use varnish.

  1. Does the dynamic content in your application change very often:To illustrate the point , take the case of StackOverflow; the content in the portal changes very often… so it’s not ideal case to go about implementing Varnish, … you will have to purge the cache as soon as new content is added and that defeats the whole purpose of caching.
  2. Do you want to implement a caching strategy without touching your codebase: Then varnish is for you.

The ideal case of varnish usage is when you have high database reads &  few database writes e.g a publishing platform where new content is added less frequently is an ideal case for using Varnish.

I am planning to write another post on using MemCache as a caching strategy ….. and it’s comparative advantages over others.