How to configure ulimit with supervisord (to start varnish)
I am migrating a server configuration to supervisord (from ini开发者_开发百科t.d files).
There are a few instances of varish running. I remember when I started using varnish I had ulimit problems so there is the following lines in the init.d/varnish scripts
ulimit -n ${NFILES:-131072} ulimit -l ${MEMLOCK:-82000}
I am configuring supervisord to run the /usr/sbin/varnishd program with arguments.
How do you configure the ulimit settings via supervisord? Do I just wrap the varnishd program in a script?
If you really need to go this route it would be preferred to set the ulimit at a system level (see limits.conf). But varnish performs best with a malloc backend rather than a file backend, so if you have the memory resources, this would solve your ulimit problem and improve your performance. The documentation is here, but basically you have something like "-s malloc,1G" in your /etc/default/varnish:
DAEMON_OPTS="-a :80 \
-T localhost:1234 \
-f /etc/varnish/default.vcl \
-s malloc,1G"
精彩评论