I want my varnish servers to cache all files. At backend there is lighttpd hosting only static files, and there is an md5 in the url in case of file change, ex. /gfx/Bird.b6e0bc2d6cbb7dfe1a52bc45dd2b05c4.swf
). However my hit ratio is very poorly (about 0.18)
My config:
sub vcl_recv {
set req.backend=default;
### passing health to backend
if (req.url ~ "^/health.html$") {
return (pass);
}
remove req.http.If-None-Match;
remove req.http.cookie;
remove req.http.authenticate;
if (req.request == "GET") {
return (lookup);
}
}
sub vcl_fetch {
### do not cache wrong codes
if (beresp.status == 404 || beresp.status >= 500) {
set beresp.ttl = 0s;
}
remove beresp.http.Etag;
remove beresp.http.Last-Modified;
}
sub vcl_deliver {
set resp.http.expires = "Thu, 31 Dec 2037 23:55:55 GMT";
}
I have made an performance tuning:
DAEMON_OPTS="${DAEMON_OPTS} -p thread_pool_min=200 -p thread_pool_max=4000 -p thread_pool_add_delay=2 -p session_linger=100"
- The main url which is missed is... /health.html. Is that forward to backend correctly configured?
- Disabling health checking hit ratio increases to 0.45. Now mostly "/crossdomain.xml" is missed (from many domains, as it is wildcard). How can I avoid that?
- Should I carry on other headers like User-Agent or Accept-Encoding? I thing that default hashing mechanism is using url + host/IP. Compression is used at the backend.
- What else can improve performance?