Varnish is Running out of Control!
October 09, 2012
My servers now a days run Varnish simply for the speed. On my main site Varnish was getting out of control with the RAM / Memory usage. Varnish would slowly creep up and eat all the memory, even though I was trying to hack Varnish to only use 128MB of ram, especially since the site is hosted on a lowendbox by Frantech (Buyvm.net). The answer, which I am not really sure WHY it works, but inside of vcl_fetch in the /etc/varnish/*.vcl file, I had set beresp.grace to be 30M, I tried this with 2M as well, but ultimately I took out the grace period setting and now my box is running Varnish with Lighttpd and PHP-FPM getting around 15k-30k unique hits a day and not going over 156MB of RAM usage.
In the end, if you were like me and tried everything you could think of to stop your server from running out of memory but nothing seemed to work. Try my little trick of either removing the grace period or setting it to something like 30s-2m and see if that improves your varnish setup.
Category: Lighttpd, Linux, PHP, Tricks, Varnishapache, box, cache, control, fast, fix, fpm, hack, hacking, help, howto, low end, memory, nginx php, out, ram, running, server, stable, trick, varnish