I'm running an instance of Varnish with load-balancing to several backends. I want to get the statistics of the cache hits, cache misses, hit for pass for each backend and not the total if the server but varnishstat doesn't seem to have this information.

Do you guys know a way of getting this statistics?


Honestly, I'm not sure this makes sense. The backends don't store the cache data, Varnish does. Further, Varnish doesn't "select" a backend unless the cache misses. Taken together, this means that in a typical case, the number of cache misses for each of two backends, for example, is exactly half of the total. Now, I know you can get quite a bit fancier than this—for example, you might have different backends for administrative access modalities. However, that then simply makes this question a specific case of the general question, "Can I break down varnishstat output by (arbitrary distinction)?", the answer to which is, "No."

However, you can probably insert more data into varnishstat's output by using inline C in your VCL to directly modify the buffer from which varnishstat reads; never tried it, mind you, but seems like it should work. Failing that, you can always use the inline C to update your very own buffer (even an external one, e.g. memcache) and then write your own query program for it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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