cache empties itself?

DHF varnish-list at
Thu Apr 3 18:07:53 CEST 2008

Sascha Ottolski wrote:
> how can this be? My varnish runs for about 36 hours now. yesterday 
> evening, the resident memory size was like 10 GB, which is still way 
> below the available 32. later that evening, I stopped letting request 
> to the proxy over night. now I came back, let the request back in, and 
> am wondering that I see a low cacht hit rate. looking a bit closer it 
> appears as if the cache got smaller over night, now the process only 
> consumes less than 1 GB of resident memory, which fits the 
> reported "bytes allocated" in the stats.
> can I somehow find out why my cached objects were expired? I have a 
> varnishlog -w running all the time, the the information might there. 
> but, what to look for, and even more important, how can I prevent that 
> expiration? I started the daemon with
> -p default_ttl=31104000
> to make it cache very aggresively...
There could be a lot of factors, is apache setting a max-age on the 
items?  As it says in the man page:

           The default time-to-live assigned to objects if neither the 
           nor the configuration assign one.  Note that changes to this 
           eter are not applied retroactively.

Is this running on a test machine in a lab where you can control the 
requests this box gets?  If so you should run some tests to make sure 
that you really are caching objects.  Run wireshark on the apache server 
listening on port 80, and using curl send two requests for the same 
object, and make sure that only one request hits the apache box.  If 
thats working like you expect, and the Age header is incrementing, then 
you need to run some tests using a typical workload that your apache 
server expects to see.  Are you setting cookies on this site?

I think what is happening is that you are setting a max-age on objects 
from apache ( which you can verify using curl, netcat, telnet, whatever 
you like ), and varnish is honoring that setting and expiring items as 
instructed.  I'm not awesome with varnishtop and varnishlog yet, so I'm 
probably not the one to ask about getting those to show you an objects 
attributes, anyone care to assist on that front?


More information about the varnish-misc mailing list