varnish increased the load

Poul-Henning Kamp phk at
Thu Jul 26 10:32:09 CEST 2007

In message <001601c7cece$ad1c5b10$c600a8c0 at r00t>, "Releaselog |" wri

>By load increased, I mean the load which is returned by server after 
>"uptime" command. It was previously at values about 1-3 out of the peak and 
>now it stays well above 6 most of the time, getting to something as high as 
>20 or 40 in the peak time (evenings). Overally, I think it's MySQL database 
>which is overloading, but there aren't many things in my mind which could 
>help the situation apart from buying next (expensive) server if you say 
>Varnish works fine at my box...

It's kind of like a patient saying "Doctor it hurts", doctors really
hate that, at the bare minimum they'd like to know _where_ it hurts
and what you did before it started hurting :-)

Here are some suggestions:

What is your hit-rate in varnish (use varnishstat to see the stats)

Are you happy with that number or should it be higher ?

If it should be higher, you need to use varnishlog to find out why
varnish doesn't cache things ( long...) as you expect.

A likely culprit is the calculation of cache-TTL, by default Varnish
uses 120 seconds if nothing else can be deduced from the headers
from the backend server.  (The 120 is a parameter you can set
while running).

If your backend doesn't send headers which varnish can use to
calculate the TTL, you can use VCL to change it for specific
content, for instance:

	vcl_fetch {
		if (req.url ~ ".png") {
			obj.ttl = 1h;

Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.

More information about the varnish-misc mailing list