best varnishd config for static files

Kristian Lyngstol kristian at redpill-linpro.com
Fri Apr 24 14:21:52 CEST 2009


On Fri, Apr 24, 2009 at 01:28:36PM +0200, Kain Sascha wrote:
> /usr/local/sbin/varnishd -a :80 -b 89.250.xx.xx:80 -s malloc,15360M

You may want to supply a -w. The default is really whimpy which could
create problems during spikes of traffic. Try something like -w 400,800.
Varnishstat n_wrk_limited and n_wrk_drop are values you don't want to
increase after the initial startup. n_wrk_limited can increase a little
every once in a while, but it should only happen on significant load
spikes.
 
> I didnt use a config file, because i think i dont need it for static files only.
> is this correct?

The default TTL is 120s if I am not much mistaken. You probably want it to
be something closer to 500h or some other really long period of time. This
has to be done in VCL if your backends don't deliver
s-maxage/max-age/Expires: headers.

For instance:

vcl_fetch:
set obj.ttl = 500h;

> Is this a good solution?

Yes, though you should make sure varnish caches as much as you want it to
and watch the hitrate in varnishstat and check what is actually going to
the backends most frequently with varnishtop -i TxURL. With varnishtop -i
TxURL, you really shouldn't see many values above 1-3 for static content.

> 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.

The X-Varnish HTTP header can tell you if it is a hit or not. It gives you
one or two numbers: One is a transaction id, and the last identifies the
original transaction that fetched the object. One number: MISS; two
numbers: HIT.

-- 
Kristian Lyngstøl
Redpill Linpro AS
Tlf: +47 21544179
Mob: +47 99014497
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20090424/cdeacd51/attachment-0003.pgp>


More information about the varnish-misc mailing list