Here is my Varnish conf:
/usr/sbin/varnishd \
-a 127.0.0.1:6081 \
-T 127.0.0.1:6082 \
-f /varnish/default.vcl \
-P %t/%N/varnishd.pid \
-s malloc,4G \
-p thread_pools=12 -p thread_pool_min=250 -p default_ttl=1 -p default_grace=0 -p timeout_idle=1800
So 12 * 250 = 3000 threads. With this setup, I end up with more than 400k open files.
Reducing the number of threads to the minimum does indeed reduce the number of open files a lot.
Question is: how is that possible ? is it normal that each Varnish thread takes so much open files ?
EDIT: Here's my VCL file:
vcl 4.1;
backend someBackend {
.host = "someBackend.net";
.connect_timeout = 2s;
.first_byte_timeout = 5s;
.between_bytes_timeout = 5s;
}
sub vcl_recv {
# Remove Varnish from X-Forwarded-For (set by Nginx)
set req.http.X-Forwarded-For = regsub(req.http.X-Forwarded-For, ",[^,]+$", "");
}
sub vcl_backend_fetch {
# Hide Varnish token
unset bereq.http.X-Varnish;
}
sub vcl_backend_response {
unset beresp.http.Vary;
}
sub vcl_deliver {
unset resp.http.Via;
unset resp.http.X-Varnish;
}