Varnish cache - something for nothing.

home | blog | Terrible people and places | Covid-19 links | Teh Internet | guest blog |rants | placeholder | political | projects | Gwen and Liam | Citadel patched | Tools | Scouts

Have some Concrete5 sites that might need some help getting "over the hump" during busy times?
How about trying out Varnish cache?
The always smarter than me boss man put this in place on a site that was having issues during peak times and it helped the site stay alive.

Being a file backed cache, it can help keep some frequently served files cached for the big wave times.
With the default cache time of 120 seconds, it should not get in the way, and NWLinux found a way to allow bypass of login cookies within the Varnish DSL regex:
NWLinux's How To
Probably not the ultimate solution for sites that need cookies for browsing public - i.e. shopping sites, but seems ok for info sites.

Looks like Franz thinks Varnish is not a bad idea either (see comments below the article)

If you have large video files, you might want to hack up the default.vcl to pipe (assuming a recent version of Varnish is installed).
if (req.request == "GET" && req.url ~ "\.(svg|swf|ico|mp3|mp4|m4a|ogg|mov|avi|wmv|flv)$") {
        return (pipe);

This will let you Varnish skip the cache and stream to Apache.

If you are having Varnish restart issues under load:
Damn, love the title of this one - See this for what Shawn Tan says
And as always, I will republish the bits that are of use in case that moves:
Under load, varnish can time out when starting up under load, and fail to talk to the back-end in time.
To fix that, add the cli_timeout switch to the daemon options.
Might want to bump it up a bit, as would it not suck to have your varnish cache fail during times of most need (i.e. highest load)?
Looks like the current default is 10 seconds.
More bits to tune here