Is there a way to list the contents of the varnish cache storage? Also, it would be nice to somehow list the most frequent cache hits.
I found a way to see the most frequent cache misses by listing what is being sent to the backend with:
varnishtop -b -i TxURL
It would be very useful to see what are my top cache hits URLs.
Edit: I am using version: varnish-3.0.3 revision 9e6a70f
Varnish Cache is a powerful, open source HTTP engine/reverse HTTP proxy that can speed up a website by up to 1000 percent by doing exactly what its name implies: caching (or storing) a copy of a webpage the first time a user visits.
Varnish Cache stores content in pluggable modules called storage backends. It does this via its internal stevedore interface.
Varnish Cache is a popular tool due to how quickly it delivers content from the cache and how flexible it can be. Using Varnish Cache's domain-specific language, Varnish Cache Configuration Language (VCL), users can cache both static and so-called “dynamic” content, also known as the HTML document.
I think this you can help:
You can use the parameter "Varnish:hitmiss" of varnishncsa.
First capture a sample of logs with:
varnishncsa -F '%U%q %{Varnish:hitmiss}x' -n NAME -w /path/requests.logs
and then:
sort -k 1 /path/requests.logs | uniq -c | sort -k 1 -n -r | head -25
This feature is not included in Varnish, but you can easily add some scripting to do so.
%{Varnish:hitmiss}x
and %U
(see varnishncsa doc)# we admit %{Varnish:hitmiss}x is the first column and %U the second awk '$0 ~ / hit / { arr[$8]=arr[$8]+1 }END{ for(k in arr) { print arr[k]";"k } }' varnishncsa.log|sort -k 1 -nr |head
And feel free to update for your specific needs..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With