virtual memory/cache hitrate problem

Loesche, Lukas, scoyo lukas.loesche at
Mon May 18 00:53:08 CEST 2009

Hi everyone,

I'm running varnish (2.0.2) on Linux x64 inside Virtuozzo Containers 4.0.
The container has got 2GB core memory assigned.

I have a backend that holds about 30GB binary objects. Varnish is set to
assign a ttl of 30 days to each object it caches.

I start varnish with -s file,/var/lib/varnish/varnish_storage.bin,50GB

because I assumed it would be wise to have a cache file that is larger than
the max. amount of backend objects.

However I see a sawtooth behaviour in cache hit rate that corresponds with
the server's virtual memory allocation.

Munin stats:

It looks like varnish hits the container's memory limit, purges all memory
and all objects from the store and starts from the beginning.

If I set -s file to 1500MB virtual memory usage is at a constant 1.5GB as
one would expect.

However my goal is to have all objects (30GB) on the varnish server's local
disk, and the most requested 1.5-2GB in it's core memory.

I thought that setting the file store size to 50GB would do the trick and
the server than would decide which objects are hold in memory and which are
read from local disk, however the 100% MISS ratio whenever the server hit's
it's virtual memory allocation limit tells me I've done something wrong.

Any ideas as to what that might be? Am I using varnish the wrong way?

-- Lukas

More information about the varnish-misc mailing list