Varnish under OpenSuSE 11.1 (and daemontools)

Carlos Valiente superdupont at gmail.com
Fri Oct 29 15:29:29 CEST 2010


For those planning to run Varnish on OpenSuSE 11.1 (or perhaps any
other SuSE flavour): You might save yourself some time if you add the
following lines to ``/etc/security/limits.conf``:

   <varnish uid>    soft    as    unlimited
   <varnish uid>    hard   as    unlimited

OpenSuSE systems ship with a 20 GB limit on the virtual memory size.
If your cache file is bigger than that, ``varnishd`` will not start.
The upper limit may be checked like this:

    # ulimit -v
    19909440
    #

After modifying ``/etc/security/limits.conf`` I was able to run
Varnish from the command-line, but running it under daemontools
(http://cr.yp.to/daemontools.html) still failed. Wrapping the call to
``varnishd`` with daemontools' ``softlimit``
(http://cr.yp.to/daemontools/softlimit.html) seems to work. These are
the relevant bits from my daemontools start script:

    #!/bin/sh
    #
    # exec 2>&1
    #
    [...]
    cache_size_gb="80"
    vmem_limit=$(echo "($cache_size_gb + 1) * 1024 * 1024 * 1024" | bc)

    exec \
        softlimit -a $vmem_limit \
        varnishd \
            -s file,/var/lib/varnish,$cache_size_gb \
            [...]




More information about the varnish-misc mailing list