- varnishd·续4
- thread_pool_min#
- thread_pool_reserve#
- thread_pool_stack#
- thread_pool_timeout#
- thread_pool_watchdog#
- thread_pools#
- thread_queue_limit#
- thread_stats_rate#
- timeout_idle#
- timeout_linger#
- transit_buffer#
- uncacheable_ttl#
- vary_notice#
- vcc_allow_inline_c#
- vcc_err_unref#
- vcc_feature#
- vcc_unsafe_path#
- vcl_cooldown#
- vcl_path#
- vmod_path#
- vsl_buffer#
- vsl_mask#
- vsl_reclen#
- vsl_space#
- vsm_free_cooldown#
- workspace_backend#
- workspace_client#
- workspace_session#
- workspace_thread#
- EXIT CODES#
- SEE ALSO#
- HISTORY#
- COPYRIGHT#
varnishd·续4
thread_pool_min#
- Units: threads
- Default: 100
- Minimum: 5
- Maximum: thread_pool_max
- Flags: delayed
The minimum number of worker threads in each pool.
Increasing this may help ramp up faster from low load situations or when threads have expired.
Technical minimum is 5 threads, but this parameter is strongly recommended to be at least 10
thread_pool_reserve#
- Units: threads
- Default: 0 (auto-tune: 5% of thread_pool_min)
- Maximum: 95% of thread_pool_min
- Flags: delayed
The number of worker threads reserved for vital tasks in each pool.
Tasks may require other tasks to complete (for example, client requests may require backend requests, http2 sessions require streams, which require requests). This reserve is to ensure that lower priority tasks do not prevent higher priority tasks from running even under high load.
The effective value is at least 5 (the number of internal priority classes), irrespective of this parameter.
thread_pool_stack#
- Units: bytes
- Default: 80k
- Minimum: sysconf(_SC_THREAD_STACK_MIN)
- Flags: delayed
Worker thread stack size. This will likely be rounded up to a multiple of 4k (or whatever the page_size might be) by the kernel.
The required stack size is primarily driven by the depth of the call-tree. The most common relevant determining factors in varnish core code are GZIP (un)compression, ESI processing and regular expression matches. VMODs may also require significant amounts of additional stack. The nesting depth of VCL subs is another factor, although typically not predominant.
The stack size is per thread, so the maximum total memory required for worker thread stacks is in the order of size = thread_pools x thread_pool_max x thread_pool_stack.
Thus, in particular for setups with many threads, keeping the stack size at a minimum helps reduce the amount of memory required by Varnish.
On the other hand, thread_pool_stack must be large enough under all circumstances, otherwise varnish will crash due to a stack overflow. Usually, a stack overflow manifests itself as a segmentation fault (aka segfault / SIGSEGV) with the faulting address being near the stack pointer (sp).
Unless stack usage can be reduced, thread_pool_stack must be increased when a stack overflow occurs. Setting it in 150%-200% increments is recommended until stack overflows cease to occur.
thread_pool_timeout#
- Units: seconds
- Default: 300.000
- Minimum: 10.000
- Flags: delayed, experimental
Thread idle threshold.
Threads in excess of thread_pool_min, which have been idle for at least this long, will be destroyed.
thread_pool_watchdog#
- Units: seconds
- Default: 60.000
- Minimum: 0.100
- Flags: experimental
Thread queue stuck watchdog.
If no queued work have been released for this long, the worker process panics itself.
thread_pools#
- Units: pools
- Default: 2
- Minimum: 1
- Maximum: 32
- Flags: delayed, experimental
Number of worker thread pools.
Increasing the number of worker pools decreases lock contention. Each worker pool also has a thread accepting new connections, so for very high rates of incoming new connections on systems with many cores, increasing the worker pools may be required.
Too many pools waste CPU and RAM resources, and more than one pool for each CPU is most likely detrimental to performance.
Can be increased on the fly, but decreases require a restart to take effect, unless the drop_pools experimental debug flag is set.
thread_queue_limit#
- Units: requests
- Default: 20
- Minimum: 0
- Flags: experimental
Permitted request queue length per thread-pool.
This sets the number of requests we will queue, waiting for an available thread. Above this limit sessions will be dropped instead of queued.
thread_stats_rate#
- Units: requests
- Default: 10
- Minimum: 0
- Flags: experimental
Worker threads accumulate statistics, and dump these into the global stats counters if the lock is free when they finish a job (request/fetch etc.) This parameters defines the maximum number of jobs a worker thread may handle, before it is forced to dump its accumulated stats into the global counters.
timeout_idle#
- Units: seconds
- Default: 5.000
- Minimum: 0.000
- Maximum: 3600.000
Idle timeout for client connections.
A connection is considered idle until we have received the full request headers.
This parameter is particularly relevant for HTTP1 keepalive connections which are closed unless the next request is received before this timeout is reached.
timeout_linger#
- Units: seconds
- Default: 0.050
- Minimum: 0.000
- Flags: experimental
How long the worker thread lingers on an idle session before handing it over to the waiter. When sessions are reused, as much as half of all reuses happen within the first 100 msec of the previous request completing. Setting this too high results in worker threads not doing anything for their keep, setting it too low just means that more sessions take a detour around the waiter.
transit_buffer#
- Units: bytes
- Default: 0b
- Minimum: 0b
The number of bytes which Varnish buffers for uncacheable backend streaming fetches - in other words, how many bytes Varnish reads from the backend ahead of what has been sent to the client. A zero value means no limit, the object is fetched as fast as possible.
When dealing with slow clients, setting this parameter to non-zero can prevent large uncacheable objects from being stored in full when the intent is to simply stream them to the client. As a result, a slow client transaction holds onto a backend connection until the end of the delivery.
This parameter is the default to the VCL variable beresp.transit_buffer, which can be used to control the transit buffer per backend request.
uncacheable_ttl#
- Units: seconds
- Default: 2m
- Minimum: 0.000
- Flags: obj_sticky
The TTL assigned to uncacheable objects by the built-in VCL.
vary_notice#
- Units: variants
- Default: 10
- Minimum: 1
How many variants need to be evaluated to log a Notice that there might be too many variants.
vcc_allow_inline_c#
Deprecated alias for the vcc_feature parameter.
vcc_err_unref#
Deprecated alias for the vcc_feature parameter.
vcc_feature#
- Default: none,+err_unref,+unsafe_path
Enable/Disable various VCC behaviors.
default Set default value (deprecated: use param.reset)
none Disable all behaviors.
Use +/- prefix to enable/disable individual behavior:
err_unref Unreferenced VCL objects result in error.
allow_inline_c Allow inline C code in VCL.
unsafe_path Allow ‘/’ in vmod & include paths. Allow ‘import … from …’.
vcc_unsafe_path#
Deprecated alias for the vcc_feature parameter.
vcl_cooldown#
- Units: seconds
- Default: 600.000
- Minimum: 1.000
How long a VCL is kept warm after being replaced as the active VCL (granularity approximately 30 seconds).
vcl_path#
NB: The actual default value for this parameter depends on the Varnish build environment and options.
- Default: ${sysconfdir}/varnish:${datadir}/varnish/vcl
Directory (or colon separated list of directories) from which relative VCL filenames (vcl.load and include) are to be found. By default Varnish searches VCL files in both the system configuration and shared data directories to allow packages to drop their VCL files in a standard location where relative includes would work. Includes using +glob cannot be searched in vcl_path.
vmod_path#
NB: The actual default value for this parameter depends on the Varnish build environment and options.
- Default: ${libdir}/varnish/vmods
Directory (or colon separated list of directories) where VMODs are to be found.
vsl_buffer#
- Units: bytes
- Default: 16k
- Minimum: vsl_reclen + 12 bytes
Bytes of (req-/backend-)workspace dedicated to buffering VSL records. When this parameter is adjusted, most likely workspace_client and workspace_backend will have to be adjusted by the same amount.
Setting this too high costs memory, setting it too low will cause more VSL flushes and likely increase lock-contention on the VSL mutex.
vsl_mask#
- Default: all,-Debug,-ObjProtocol,-ObjStatus,-ObjReason,-ObjHeader,-ExpKill,-WorkThread,-Hash,-VfpAcct,-H2RxHdr,-H2RxBody,-H2TxHdr,-H2TxBody,-VdpAcct
Mask individual VSL messages from being logged.
all Enable all tags
default Set default value (deprecated: use param.reset)
Use +/- prefix in front of VSL tag name to unmask/mask individual VSL messages. See vsl(7) for possible values.
vsl_reclen#
- Units: bytes
- Default: 255b
- Minimum: 16b
- Maximum: vsl_buffer - 12 bytes
Maximum number of bytes in SHM log record.
vsl_space#
- Units: bytes
- Default: 80M
- Minimum: 1M
- Maximum: 4G
- Flags: must_restart
The amount of space to allocate for the VSL fifo buffer in the VSM memory segment. If you make this too small, varnish{ncsa|log} etc will not be able to keep up. Making it too large just costs memory resources.
vsm_free_cooldown#
- Units: seconds
- Default: 60.000
- Minimum: 10.000
- Maximum: 600.000
How long VSM memory is kept warm after a deallocation (granularity approximately 2 seconds).
workspace_backend#
- Units: bytes
- Default: 96k
- Minimum: 1k
- Flags: delayed
Bytes of HTTP protocol workspace for backend HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency.
workspace_client#
- Units: bytes
- Default: 96k
- Minimum: 9k
- Flags: delayed
Bytes of HTTP protocol workspace for clients HTTP req/resp. Use a multiple of 4k for VM efficiency. For HTTP/2 compliance this must be at least 20k, in order to receive fullsize (=16k) frames from the client. That usually happens only in POST/PUT bodies. For other traffic-patterns smaller values work just fine.
workspace_session#
- Units: bytes
- Default: 0.75k
- Minimum: 384b
- Flags: delayed
Allocation size for session structure and workspace. The workspace is primarily used for TCP connection addresses. If larger than 4k, use a multiple of 4k for VM efficiency.
workspace_thread#
- Units: bytes
- Default: 2k
- Minimum: 0.25k
- Maximum: 8k
- Flags: delayed
Bytes of auxiliary workspace per thread. This workspace is used for certain temporary data structures during the operation of a worker thread. One use is for the IO-vectors used during delivery. Setting this parameter too low may increase the number of writev() syscalls, setting it too high just wastes space. ~0.1k + UIO_MAXIOV * sizeof(struct iovec) (typically = ~16k for 64bit) is considered the maximum sensible value under any known circumstances (excluding exotic vmod use).
EXIT CODES#
Varnish and bundled tools will, in most cases, exit with one of the following codes
0OK1Some error which could be system-dependent and/or transient2Serious configuration / parameter error - retrying with the same configuration / parameters is most likely useless
The varnishd master process may also OR its exit code
- with
0x20when thevarnishdchild process died, - with
0x40when thevarnishdchild process was terminated by a signal and - with
0x80when a core was dumped.
SEE ALSO#
HISTORY#
The varnishd daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software.
This manual page was written by Dag-Erling Smørgrav with updates by Stig Sandbeck Mathisen <ssm@debian.org>, Nils Goroll and others.
COPYRIGHT#
This document is licensed under the same licence as Varnish itself. See LICENCE for details.
- Copyright (c) 2007-2015 Varnish Software AS
