best varnishd config for static files
kristian at redpill-linpro.com
Mon Apr 27 09:16:08 CEST 2009
On Fri, Apr 24, 2009 at 03:28:22PM +0200, Kain Sascha wrote:
> Thanks a lot for the great Hints.
> First of all, varnishtop -i TxURL hangs on my system, it shows 3-5 Entries,
> then freez and uses nearly 100%cpu on one of 8. Have to kill the pid.
> varnishtop with no args works.
Ok, that's not good... I've seen varnishtop hang like that before, but not
with CPU usage. I've yet to be able to properly debug this as I can't
reproduce it myself...
What GNU+Linux distribution are you using?
If your miss-rate is low enough, you may be able to get some sense out of
varnishlog -b instead of varnishtop, but varnishtop really is the tool you
want... At any rate, with static content, varnishstat should show you a
hitrate in the 0.99-range (99% hit-rate, for static content, I'd say 0.999
is well within reach), unless you have a huge dataset with very even
distribution of hits.
> Here is our Answer-Header, so we provide the max-age.
> Cache-Control max-age=2592000
> Vary Accept-Encoding
> Expires Wed, 29 Apr 2009 21:14:47 GMT
> Content-Type image/jpeg
> Etag "857407780"
> Last-Modified Mon, 30 Mar 2009 20:35:52 GMT
> Server lighttpd/1.4.20
> Content-Length 1392
> Date Fri, 24 Apr 2009 13:19:59 GMT
> X-Varnish 623951818 451344757
> Age 2131515
> Via 1.1 varnish
> Connection keep-alive
Looks good. Age: confirms that this object is 592 hours old too. On
long-duration caching like this, keep in mind that these headers affect
client-cache too. If that doesn't bother you, you can leave them as is, but
if you want varnish to cache for, say 720 hours, but clients should check
back every 24 hours (in case you force purges), you can modify the max-age
header before sending it out.
> > > Sometimes im getting a 503 error when the static server has high load.
> > > Also sometimes i am waiting a long time for some files that has to be on
> > > RAM allready.
Can you check if the X-Varnish header has one or two numbers on these
errors/slow pages? The Age: header can tell you some of the same
information, but on slow gets, it's not uncommon to see a positive age on
Redpill Linpro AS
Tlf: +47 21544179
Mob: +47 99014497
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 197 bytes
Desc: not available
More information about the varnish-misc