Score:0

How do you log the requests that are not getting a cache hit on varnish?

dk flag

Made a new theme on Wordpress, the new theme is very similar to the old one, meaning there shouldn't be any major SQL queries change, probably less, but the website is slow and it seems it comes from varnish.

How do I debug varnish to see which queries are not getting a cache hit? I am suspecting it's some ajax call, but there are 100 of them, so I need to know which ajax is not getting cached. How do you do that?

Score:0
in flag

For more information about debugging Varnish, I'd like to point to you to the following Varnish Developer Portal article: https://www.varnish-software.com/developers/tutorials/troubleshooting-varnish/#varnish-is-not-caching

In your specific case I'm going to assume the AJAX calls start with /ajax/. With that assumption, you can use the following varnishlog command to debug this:

varnishlog -g request -q "(VCL_call eq 'MISS' or VCL_call eq 'PASS') and ReqUrl ~ '^/ajax/'"

This command will list both cache misses and cache bypasses. The difference is that a miss is just a hit that didn't take place yet, whereas a cache pass will always bypass the cache and will never result in a cache hit.

dk flag
Is it possible to just log it into a file?
Thijs Feryn avatar
in flag
Sure, for that you'd use the following command: `varnishlog -g request -q "(VCL_call eq 'MISS' or VCL_call eq 'PASS') and ReqUrl ~ '^/ajax/'" -a -A -w filename.log`
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.