I've configured Varnish to use a file storage. Varnish seems to be working, but the cache seems to be a fraction of the size I've specified and the file I've specified for the storage does not seem to have been created.
I've been running service varnish reload
to restart the service after making config changes. Is that sufficient?
Running varnishstatus
shows an ever-increasing MAIN.n_lru_nuked
value, which I assume means it thinks it's run out of cache space however SMA.s0.c_bytes
(which I believe is the size of the storage back-end?) is only at 3.46G
.
Any ideas how I can debug this? Is my config not getting picked up?
Config portion of /etc/default/varnish
VARNISH_LISTEN_PORT=80
DAEMON_OPTS="-a :80 \
-T localhost:6082 \
-b s3.amazonaws.com:80 \
-u varnish -g varnish \
-S /etc/varnish/secret \
-s disk=file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,30G"
/etc/varnish/default.vcl
vcl 4.0;
backend default {
.host = "cdn.webampskins.org.s3.amazonaws.com";
.port = "80";
}
sub vcl_recv {
set req.http.Host = "cdn.webampskins.org.s3.amazonaws.com";
}
sub vcl_backend_response {
set beresp.ttl = 3y;
set beresp.storage_hint = "disk";
# I've confirmed that in my response I see this header
set beresp.http.x-storate = "disk";
}
sub vcl_deliver {
# Empty
}
Update:
It seems that my file storage config is not getting picked up:
~# varnishadm storage.list
Storage devices:
storage.s0 = malloc
storage.Transient = malloc
Not sure why, or how to debug.