Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When a page is cached in varnish, internally does it store the page on disk or memory?

What if a single server cannot store all the cached pages, does it have clustering or do you then choose which varnish server to cache? i.e. it is done at the application level?

share|improve this question
up vote 1 down vote accepted

by default it stores it on disk but lets the OS decide to keep it in memory or not. There is also the malloc option which says always store in RAM and persist option which means keep the cache on disk and save even on a restart

There is no clustering but you can specify how big you want your cache to be.

share|improve this answer
so how would a site like facebook use varnish when there is no clustering? i.e. it all can't fit on a single server. i guess something like haproxy is used to hash the request and send it to the correct varnish box? – codecompleting Jul 19 '11 at 14:53
so you what if your cache can't fit on a single server? how do you shard, based on? – codecompleting Nov 22 '11 at 15:04
facebook isn't 1 giant app.. it is many apps all making up a big one. So all requests are going through many caching layers. I know they use varnish.. just not sure to what extent. – Mike Nov 23 '11 at 3:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.