VARNISHD(1)

NAME
varnishd - HTTP accelerator daemon

SYNOPSIS
varnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config] [-g group] [-h type[,options]] [-n name] [-P file] [-p param=value] [-s type[,options]] [-T address[:port]] [-t ttl] [-u user] [-V] [-w min[,max[,timeout]]]

DESCRIPTION
The varnishd daemon accepts HTTP requests from clients, passes them on to a backend server and caches the returned documents to better satisfy future requests for the same document.

The following options are available:

-a address[:port]
    Listen for client requests on the specified address and port. The address can be a host name (“localhost”), an IPv4 dotted-quad (“127.0.0.1”), or an IPv6 address enclosed in square brackets (“[::1]”). If address is not specified, varnishd will listen on all available IPv4 and IPv6 interfaces. If port is not specified, the default HTTP port as listed in /etc/services is used.

-b host[:port]
    Use the specified host as backend server. If port is not specified, the default is 8080.

-d  Enables debugging mode. This causes varnishd to fork; the child process daemonizes and runs as usual, while the parent process remains attached to the console and will accept management commands from stdin. If the parent process receives EOF, it will terminate, but the child process will continue to run.

    The child process will not start accepting client connections until the start command is given.

    If the -d flag is specified twice, the child process will not daemonize, and terminating the parent process will also terminate the child.

-F  Run in the foreground.

-f config
    Use the specified VCL configuration file instead of the builtin default. See vcl(7) for details on VCL syntax.

-g group
    Specifies the name of an unprivileged group to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the group run-time parameter.

-h type[,options]
    Specifies the hash algorithm. See Hash Algorithms for a list of supported algorithms.

-n  Specify a name for this instance. Amonst other things, this name is used to construct the name of the directory in which varnishd keeps temporary files and persistent state. If the specified name begins with a forward slash, it is interpreted as the absolute path to the directory which should be used for this purpose.

-P file
    Write the process's PID to the specified file.

-p param=value
    Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parameters.

-s type[,options]
    Use the specified storage backend. See Storage Types for a list of supported storage types.

-T address[:port]
    Offer a management interface on the specified address and port. See Management Interface for a list of management commands.

-t ttl
    Specifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter.

-u user
    Specifies the name of an unprivileged user to which the child process should switch before it starts accepting connections. This is a shortcut for specifying the user run-time parameter.

    If specifying both a user and a group, the user should be specified first.

-V  Display the version number and exit.

-w min[,max[,timeout]]
    Start at least min but no more than max worker threads with the specified idle timeout. This is a shortcut for specifying the thread_pool_min, thread_pool_max and thread_pool_timeout run-time parameters.

    If only one number is specified, thread_pool_min and thread_pool_max are both set to this number, and thread_pool_timeout has no effect.

  Hash Algorithms
The following hash algorithms are available:

simple_list
    A simple doubly-linked list. Not recommended for production use.

classic[,buckets]
    A standard hash table. This is the default.

    The hash key is the CRC32 of the object's URL modulo the size of the hash table. Each table entry points to a list of elements which share the same hash key.

    The buckets parameter specifies the number of entries in the hash table. The default is 16383.

  Storage Types
The following storage types are available:

malloc
    Storage for each object is allocated with malloc(3). Not recommended for production use.

file[,path[,size]]
    Storage for each object is allocated from an arena backed by a file. This is the default.

    The path parameter specifies either the path to the backing file or the path to a directory in which varnishd will create the backing file. The default is /tmp.

    The size parameter specifies the size of the backing file. The size is assumed to be in bytes, unless followed by one of the following suffixes:

    K, k
        The size is expressed in kibibytes.

    M, m
        The size is expressed in mebibytes.

    G, g
        The size is expressed in gibibytes.

    T, t
        The size is expressed in tebibytes.

    %   The size is expressed as a percentage of the free space on the file system where it resides.

    The default size is 50%.

    If the backing file already exists, it will be truncated or expanded to the specified size.

    Note that if varnishd has to create or expand the file, it will not pre-allocate the added space, leading to fragmentation, which may adversely impact performance. Pre-creating the storage file using dd(1) will reduce fragmentation to a minimum.

  Management Interface
If the -T option was specified, varnishd will offer a command-line management interface on the specified address and port. The following commands are available:

dump.pool

help
    Display a list of available commands.

param.set param value
    Set the parameter specified by param to the specified value. See Run-Time Parameters for a list of parameters.

param.show param
    Display the value of the parameter specified by param. See Run-Time Parameters for a list of parameters.

param.show [-l]
    Display a list of run-time parameters and their values. If the -l option is specified, the list includes a brief explanation of each parameter.

ping [timestamp]
    Ping the child process.

start
    Start the child process if it is not already running.

stats
    Display server statistics. All the numbers presented are totals since server startup; for a better idea of the current situation, use the varnishstat(1) utility.

status
    Check the status of the child process.

stop
    Stop the child process.

url.purge regexp
    Immediately invalidate all documents whos URL matches the specified regular expression.

vcl.discard configname
    Discard the configuration specified by configname. This will have no effect if the specified configuration has a non-zero reference count.

vcl.inline configname vcl
    Create a new configuration named configname with the VCL code specified by vcl, which must be a quoted string.

vcl.list
    List available configurations and their respective reference counts. The active configuration is indicated with an asterisk ("*").

vcl.load configname filename
    Create a new configuration named configname with the contents of the specified file.

vcl.show configname
    Display the source code for the specified configuration.

vcl.use configname
    Start using the configuration specified by configname for all new requests. Existing requests will continue using whichever configuration was in use when they arrived.

  Run-Time Parameters

auto_restart
    Whether to automatically restart the child process if it dies.

    The default is on.

backend_http11
    Whether to force the use of HTTP/1.1 when requesting documents from the server, or just use the same protocol version as the client which triggered the retrieval.

    The default is off.

client_http11
    Whether to force the use of HTTP/1.1 when responding to client requests, or just use the same protocol version as that used by the backend server which delivered the requested document.

    The default is off.

default_ttl
    The default time-to-live assigned to objects if neither the backend nor the configuration assign one. Note that changes to this parameter are not applied retroactively.

    The default is 120 seconds.

fetch_chunksize
    The default chunk size used when retrieving documents for which the backend server does not specify a content length.

    The default is 128 kilobytes.

group
    The name of an unprivileged group to which the child process should switch before it starts accepting connections. Note that setting user will automatically set group to the primary group of the specified user, so if both user and group are specified, the latter should be specified last.

    The default is "nogroup".

http_workspace
    The size of the per-session workspace for HTTP protocol data. For performance reasons, this space is preallocated, so any change to this parameter will only apply to new client sessions.

    The default is 8192 bytes.

listen_address
    The address at which to listen for client connections. Changes to this parameter will only take effect when the child process is restarted.

    The default is 0.0.0.0:80.

listen_depth
    The depth of the TCP listen queue.

    The default is 512.

overflow_max
    The maximum depth of the overflow queue as a percentage of thread_pool_max. The overflow queue holds requests waiting for a worker thread to become available. If the overflow queue fills up, varnishd will start dropping new connections.

    The default is 100%.

ping_interval
    The interval at which the parent process will ping the child process to ascertain that it is still present and functioning.

    The default is 3 seconds.

pipe_timeout
    The time to wait before dropping an idle pipe mode connection.

    The default is 60 seconds.

sendfile_threshold
    The size threshold beyond which documents are sent to the client using sendfile(2) instead of writev(2). This is not likely to have any effect unless the working set is too large to fit in physical memory.

    Note that several operating systems have known bugs which make it inadvisable to use this.

    The default is -1, which disables the use of sendfile altogether.

send_timeout
    The time to wait before dropping the connection to a client which is not accepting data sent to it.

    The default is 600 seconds.

sess_timeout
    The time to wait before dropping an idle client session.

    The default is 5 seconds.

srcaddr_hash
    The size of the hash table used to store per-client accounting data. This should preferably be a prime number.

    The default is 1049.

srcaddr_ttl
    The length of time to keep per-client accounting records. Setting this to 0 will disable per-client accounting.

thread_pool_max
    The maximum total number of worker threads. If the number of concurrent requests rises beyond this number, requests will start queueing up waiting for a worker thread to pick them up. Higher values may improve response time but will increase pressure on the scheduler.

    The default is 1000.

thread_pool_min
    The minimum total number of worker threads. Higher values may allow varnishd to respond faster to a sudden increase in traffic.

    The default is 1.

thread_pools
    The number of worker thread pools. Higher values reduce lock contention but increase pressure on the scheduler. Note that a decrease of this parameter will only take effect after a restart.

    The default is 1.

thread_pool_timeout
    The amount of time a worker thread can be idle before it is killed, when the number of worker threads exceeds thread_pool_min.

    The default is 120 seconds.

user
    The name of an unprivileged user to which the child process should switch before it starts accepting connections. Note that setting user will automatically set group to the primary group of the specified user, so if both user and group are specified, the latter should be specified last.

    The default is "nobody".

vcl_trace
    Whether to issue log entries for calls to VCL code and their results. Note that this will generate large amounts of log data.

    The default is off.

SEE ALSO
varnishlog(1), varnishhist(1), varnishncsa(1), varnishstat(1), varnishtop(1), vcl(7)

HISTORY
The varnishd daemon was developed by Poul-Henning Kamp <phk@phk.freebsd.dk> in cooperation with Verdens Gang AS and Linpro AS. This manual page was written by Dag-Erling Smørgrav <des@linpro.no>.