I have varnish running with -s malloc,25G, but the process keeps growing until it consumes all the server memory and it crashes, restarting the cache.
Any idea what I can check to see what's wrong?
The server has 16 cores, and 32 GB of RAM.
I am using varnish 3.
28346 ? Ss 0:16 /usr/sbin/varnishd -P /var/run/varnishd.pid -a :9290 -T localhost:6082 -f /etc/varnish/default.vcl -s malloc,25G -p thread_pools 16 -p thread_pool_min 160 -p thread_pool_max 16000 -p thread_pool_add_delay 2
The -s malloc,25G
only limits the cache size, not the size of the varnishd
process.
It is important to keep in mind that the size you specify with the -s argument is the size for the actual cache. Varnish has an overhead on top of this for keeping track of the cache, so the actual memory footprint of Varnish will exceed what the ā-sā argument specifies if the cache is full. The current estimate (subject to change on individual Varnish-versions) is that about 1kB of overhead needed for each object. For 1 million objects, that means 1GB extra memory usage.
If you have a large cache, the file
backend may be preferable.