understanding cache size

Matt Schurenko MSchurenko at airg.com
Sun Oct 2 04:35:22 CEST 2011

>From what I understand sm_bfree is the amount of bytes that are free in the cache while sm_balloc is the amount of used bytes in the cache (at least with varnish version 2.1.5). What I'm trying to understand is why two servers with the exact same hardware and varnish configuration that are using the same backends can have such a drastic difference with regards to these stats. Both server have 48GB of RAM. On both servers I have configured a cache size of 48 GB like so:

-s file,/tmp/varnish-cache,48G

If I add up sm_bfree and sm_balloc on both servers they equal 48GB:

[root at varnish1 ~]# varnishstat -1 | egrep 'sm_bfree|sm_balloc'
sm_balloc         13053640704          .   bytes allocated
sm_bfree          38485966848          .   bytes free

[root at varnish1 ~]# echo 'scale=3;(13053640704 + 38485966848) / 1024 / 1024 / 1024' | bc

[root at varnish2 ~]# varnishstat -1 | egrep 'sm_bfree|sm_balloc'
sm_balloc         48657035264          .   bytes allocated
sm_bfree           2882572288          .   bytes free

[root at varnish2 ~]#  echo 'scale=3;(48657035264 + 2882572288) / 1024 / 1024 / 1024' | bc

Can anyone explain to me why varnish2 uses so much more cache than varnish1? varnish1 has been running for 24 days and it maintains the ratio of bytes allocated to bytes free by frequently lru nuking. (This average to ~ 60 lru nukes per second in MRTG) This server has been quite stable; however I have noticed a lot of disk I/O.

The problem with varnish2 is that it does no lru nuking until the cache is nearly full, at which point the worker thread count maxes out (6000 in my case) and no new clients can connect. Because of this I am only able to run this server for ~ 48 hours before I have to restart varnish.


Matt Schurenko
Systems Administrator

airG(r) Share Your World
Suite 710, 1133 Melville Street
Vancouver, BC  V6E 4E5
P: +1.604.408.2228
F: +1.866.874.8136
E: MSchurenko at airg.com
W: www.airg.com<http://www.airg.com>

airG is one of BC's Top 55 Employers and
Canada's Top Employers for Young People

P Please consider the environment before printing this e-mail.
The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material communicated under NDA. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20111001/ad808f50/attachment-0003.html>

More information about the varnish-misc mailing list