Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

This answer was originally posted on stackoverflow, and I think it is quite helpful: http://stackoverflow.com/questions/14214104/list-contents-of-varnish-cache

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

share|improve this answer
    
Soemthing is wrong with this answer. THis command gives me varnishncsa: invalid option -- 'F' –  Zyava Mar 18 '13 at 17:47

There's no way of listing the contents of the cache.

You can get the list of top requested URLs with

varnishtop -i RxURL

but there's no easy way to tell from that which are cache HITs and MISSes. There is a script here which may help you.

share|improve this answer
    
actually posted the same question on stackoverflow, got some info from there: stackoverflow.com/questions/14214104/… –  Martin Taleski Jan 17 '13 at 23:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.