Find a particular request and its relative url

Find a particular request and its relative url

If you need to find the url that serves a particular requests, i.e.: 400, you can try running this on the varnish server: varnishlog -i RxURL,TxStatus | tee /tmp/varnish.log It gives significantly less output and shows the URL and status code for each request. For…

Continue reading →

Check which server is serving the content from

Check which server is serving the content from

while true; do curl -s -I http://www.example.com/ | egrep Varnish-Host\|X-Cache | egrep –color pres\|X-Cache; done

Continue reading →

Warm up a server (populate cache)

Warm up a server (populate cache)

If you need to start a server, you might want to populate it first with some content, before putting it live to the public wget –no-directories –recursive –level 2 –delete-after http://your-host.com The publications you want to warm up need to be inside the the host…

Continue reading →

A general Varnish health check.

A general Varnish health check.

From Varnsih documentation it is quite clear that Varnishstat gives a good representation of the general health of Varnish, including cache hit rate, uptime, number of failed backend connections and many other statistics; everything above 80% is in a good state. I like to use…

Continue reading →

Useful varnishlog commands

Useful varnishlog commands

varnishtop -i TxStatus Log client requests (you can also add :503 to check only for 503 being returned to a client varnishncsa -F "%r %s" | grep " 200" Give the url that returns 200 varnishlog -c -m RxURL:/specific/url/ Only show client-requests for the url…

Continue reading →

Find the least cached URIs

Find the least cached URIs

To improve your cache hit ratio, the best thing to do is to use varnishtop to see the URIs that are the most often fetched from the back end server varnishtop -i TxURL

Continue reading →

Fetch the data through Varnish

Fetch the data through Varnish

GET -Used http://localhost:80/ HEAD and GET are the same lwp-request tool. HEAD replies with HTTP headers, while GET returns everything. In this case: -U prints the request headers -s prints the response status code which usually is “200 OK” or “404 File not found” -e…

Continue reading →