varnish命中率统计

varnish作为一款优秀的缓存中间件,在电商网站上大量使用,可以大大加快静态页面的访问速度

那么,如何统计varnish的缓存命中率呢

1、首先必须确保日志中记录了hit or miss 

需要调整启动脚本中的日志格式

${path_varnish}/bin/varnishncsa -D -n name -a -w ${path_varnish}/logs/varnishncsa.log -F "%h %l %u %t %T %{Varnish:hitmiss}x "%r" %s %b "%{User-agent}i" "%{X-Request-ID}i" "

2、通过awk工具对日志中同一个url的hit和miss数量进行统计

原文地址:https://www.cnblogs.com/takemetoyourheart/p/12683771.html