Tune Varnish Cache on NetBSD 10
Systemd override (/etc/systemd/system/varnish.service.d/override.conf)
[Service]
ExecStart=
ExecStart=/usr/sbin/varnishd \
-a :80 -T localhost:6082 \
-f /etc/varnish/default.vcl \
-s malloc,2G \
-p thread_pools=2 \
-p thread_pool_min=200 \
-p thread_pool_max=4000 \
-p thread_pool_timeout=300
Key parameters
| Parameter |
Recommendation |
thread_pools |
= CPU cores |
thread_pool_min |
200-500 |
thread_pool_max |
4000-10000 |
-s malloc |
60-70% of free RAM |
Monitor hit rate
varnishstat -1 | grep -E 'MAIN\.(cache_hit|cache_miss)'
Live request log
varnishlog -i ReqURL -i RespStatus
varnishlog -q "VCL_call eq MISS" -i ReqURL