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

I'm trying to (re)build a VM that will be running Varnish Cache. One of the issues that I've had in the past, is running out of space (allocated space was ~10G).

I guess what I'm really confused about is how Varnish uses space. As soon as I start varnish it creates a file which is (from what I assume) is equivalent to size of your memory (which is in my case 4G) yet later on varnish end up using more space...

So what I'm trying to understand is how properly I should allocate space. Maybe some advises, best practices in general.

share|improve this question
Which storage settings were you using? – Shane Madden Nov 17 '12 at 8:49
I'm using file storage, I'm considering moving that file into ram disk and have same file but on ram disk to increase performance. – alexus Nov 19 '12 at 16:55
Right, but what specific settings are in place for the -s flag of your varnishd command? That should tell us whether it's behaving properly in terms of storage behavior or not. – Shane Madden Nov 19 '12 at 17:04
-s file,/var/lib/varnish/varnish_storage.bin,1G – alexus Nov 19 '12 at 17:22
up vote 0 down vote accepted

AFAIK there was a memory leak in version 3.0.0: are you perhaps hitting it?

Rather than using a ramdisk, I would simply change the varnishd option to "malloc", for example (change the size to something more useful, of course...)

  -s malloc,1G

BTW, even if the VM is dedicated to varnish, I would not allocate more than 80% of the RAM to the cache.

share|improve this answer
I just reconfigured my VM (REDHAT6) (now it looks like this: /usr/sbin/varnishd -P /var/run/ -a :80 -f /etc/varnish/default.vcl -T -t 120 -w 1,1000,120 -u varnish -g varnish -S /etc/varnish/secret -s malloc,2G). VM has 6G of RAM, 2 of them allocated to Varnish. – alexus Nov 20 '12 at 17:36
I still seeing files in /var/lib/varnish/$HOSTNAME$/vcl.*.so & _.vsm – alexus Nov 21 '12 at 17:01
They should be (I am not 100% sure) the compiled rules and the log – marcoc Jan 3 '13 at 15:14

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.