Commit 6519159a authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Change how min/max/default values for parameters are managed.

Make min/max values strings, and test-convert them along with the
default value during startup, to see that we can.  At the same time
normalize the strings with the parameters tweak function.

List min/max values in .rst doc.

param.show will flag default values. (Better the other way around ?)

Add a new feature:

	param.show changed

will only list parameters with non-default values (in short format)
parent d36344d3
......@@ -204,34 +204,51 @@ mcf_param_show(struct cli *cli, const char * const *av, void *priv)
{
int i;
const struct parspec *pp;
int lfmt;
int lfmt = 0, chg = 0;
struct vsb *vsb;
vsb = VSB_new_auto();
(void)priv;
if (av[2] == NULL)
lfmt = 0;
else
if (av[2] != NULL && !strcmp(av[2], "changed"))
chg = 1;
else if (av[2] != NULL)
lfmt = 1;
for (i = 0; i < nparspec; i++) {
pp = parspecs[i];
if (av[2] != NULL &&
strcmp(pp->name, av[2]) &&
strcmp("-l", av[2]))
if (lfmt && strcmp(pp->name, av[2]) && strcmp("-l", av[2]))
continue;
VSB_clear(vsb);
if (pp->func(vsb, pp, NULL))
VCLI_SetResult(cli, CLIS_PARAM);
AZ(VSB_finish(vsb));
if (chg && pp->def != NULL && !strcmp(pp->def, VSB_data(vsb)))
continue;
if (lfmt) {
VCLI_Out(cli, "%s\n", pp->name);
VCLI_Out(cli, "%-*sValue is: ", margin1, " ");
} else {
VCLI_Out(cli, "%-*s", margin2, pp->name);
}
if (pp->func(cli->sb, pp, NULL))
VCLI_SetResult(cli, CLIS_PARAM);
VCLI_Out(cli, "%s", VSB_data(vsb));
if (pp->units != NULL && *pp->units != '\0')
VCLI_Out(cli, " [%s]\n", pp->units);
else
VCLI_Out(cli, " [%s]", pp->units);
if (pp->def != NULL && !strcmp(pp->def, VSB_data(vsb)))
VCLI_Out(cli, " (default)");
VCLI_Out(cli, "\n");
if (av[2] != NULL) {
VCLI_Out(cli, "%-*sDefault is: %s\n\n",
if (lfmt) {
VCLI_Out(cli, "%-*sDefault is: %s\n",
margin1, "", pp->def);
if (pp->min != NULL)
VCLI_Out(cli, "%-*sMinimum is: %s\n",
margin1, "", pp->min);
if (pp->max != NULL)
VCLI_Out(cli, "%-*sMaximum is: %s\n",
margin1, "", pp->max);
VCLI_Out(cli, "\n");
mcf_wrap(cli, pp->descr);
if (pp->flags & OBJ_STICKY)
mcf_wrap(cli, OBJ_STICKY_TEXT);
......@@ -247,16 +264,14 @@ mcf_param_show(struct cli *cli, const char * const *av, void *priv)
mcf_wrap(cli, WIZARD_TEXT);
if (pp->flags & PROTECTED)
mcf_wrap(cli, PROTECTED_TEXT);
if (!lfmt)
return;
else
VCLI_Out(cli, "\n\n");
}
}
if (av[2] != NULL && !lfmt) {
if (av[2] != NULL && !lfmt && !chg) {
VCLI_SetResult(cli, CLIS_PARAM);
VCLI_Out(cli, "Unknown parameter \"%s\".", av[2]);
}
VSB_delete(vsb);
}
/*--------------------------------------------------------------------
......@@ -381,39 +396,60 @@ MCF_AddParams(struct parspec *ps)
qsort (parspecs, nparspec, sizeof parspecs[0], mcf_parspec_cmp);
}
/*--------------------------------------------------------------------
* Wash a min/max/default value
*/
static void
mcf_wash_param(struct cli *cli, const struct parspec *pp, const char **val,
const char *name, struct vsb *vsb)
{
int err;
AN(*val);
VSB_clear(vsb);
VSB_printf(vsb, "FAILED to set %s for param %s = %s\n",
name, pp->name, *val);
err = pp->func(vsb, pp, *val);
AZ(VSB_finish(vsb));
if (err) {
VCLI_Out(cli, "%s", VSB_data(vsb));
VCLI_SetResult(cli, CLIS_CANT);
return;
}
VSB_clear(vsb);
err = pp->func(vsb, pp, NULL);
AZ(err);
AZ(VSB_finish(vsb));
if (strcmp(*val, VSB_data(vsb))) {
*val = strdup(VSB_data(vsb));
AN(*val);
}
}
/*--------------------------------------------------------------------
* Set defaults for all parameters
* Wash the min/max/default values, and leave the default set.
*/
void
MCF_InitParams(struct cli *cli)
{
const struct parspec *pp;
int i, j, err;
struct parspec *pp;
int i;
struct vsb *vsb;
/*
* We try to set the default twice, and only failures the
* second time around are fatal. This allows for trivial
* interdependencies.
*/
vsb = VSB_new_auto();
AN(vsb);
for (j = 0; j < 2; j++) {
err = 0;
for (i = 0; i < nparspec; i++) {
pp = parspecs[i];
VSB_clear(vsb);
VSB_printf(vsb,
"FAILED to set default for param %s = %s\n",
pp->name, pp->def);
err = pp->func(vsb, pp, pp->def);
AZ(VSB_finish(vsb));
if (err && j) {
VCLI_Out(cli, "%s", VSB_data(vsb));
VCLI_SetResult(cli, CLIS_CANT);
}
}
if (pp->min != NULL)
mcf_wash_param(cli, pp, &pp->min, "Minimum", vsb);
if (pp->max != NULL)
mcf_wash_param(cli, pp, &pp->max, "Maximum", vsb);
AN(pp->def);
mcf_wash_param(cli, pp, &pp->def, "Default", vsb);
}
VSB_delete(vsb);
}
......@@ -462,6 +498,10 @@ MCF_DumpRstParam(void)
if (pp->units != NULL && *pp->units != '\0')
printf("\t* Units: %s\n", pp->units);
printf("\t* Default: %s\n", pp->def);
if (pp->min != NULL)
printf("\t* Minimum: %s\n", pp->min);
if (pp->max != NULL)
printf("\t* Maximum: %s\n", pp->max);
/*
* XXX: we should mark the params with one/two flags
* XXX: that say if ->min/->max are valid, so we
......
......@@ -36,8 +36,8 @@ struct parspec {
const char *name;
tweak_t *func;
volatile void *priv;
double min;
double max;
const char *min;
const char *max;
const char *descr;
int flags;
#define DELAYED_EFFECT (1<<0)
......@@ -54,7 +54,7 @@ struct parspec {
tweak_t tweak_bool;
tweak_t tweak_bytes;
tweak_t tweak_bytes_u;
tweak_t tweak_generic_double;
tweak_t tweak_double;
tweak_t tweak_group;
tweak_t tweak_listen_address;
tweak_t tweak_poolparam;
......@@ -65,8 +65,8 @@ tweak_t tweak_uint;
tweak_t tweak_user;
tweak_t tweak_waiter;
int tweak_generic_uint(struct vsb *vsb,
volatile unsigned *dest, const char *arg, unsigned min, unsigned max);
int tweak_generic_uint(struct vsb *vsb, volatile unsigned *dest,
const char *arg, const char *min, const char *max);
/* mgt_param_tbl.c */
extern struct parspec mgt_parspec[];
......
......@@ -235,13 +235,13 @@ tweak_feature(struct vsb *vsb, const struct parspec *par, const char *arg)
*/
struct parspec VSL_parspec[] = {
{ "vsl_mask", tweak_vsl_mask, NULL, 0, 0,
{ "vsl_mask", tweak_vsl_mask, NULL, NULL, NULL,
"Mask individual VSL messages from being logged.\n"
"\tdefault\tSet default value\n"
"\nUse +/- prefixe in front of VSL tag name, to mask/unmask "
"individual VSL messages.",
0, "default", "" },
{ "debug", tweak_debug, NULL, 0, 0,
{ "debug", tweak_debug, NULL, NULL, NULL,
"Enable/Disable various kinds of debugging.\n"
"\tnone\tDisable all debugging\n\n"
"Use +/- prefix to set/reset individual bits:"
......@@ -249,7 +249,7 @@ struct parspec VSL_parspec[] = {
#include "tbl/debug_bits.h"
#undef DEBUG_BIT
, 0, "none", "" },
{ "feature", tweak_feature, NULL, 0, 0,
{ "feature", tweak_feature, NULL, NULL, NULL,
"Enable/Disable various minor features.\n"
"\tnone\tDisable all features.\n\n"
"Use +/- prefix to enable/disable individual feature:"
......
......@@ -29,7 +29,6 @@
#include "config.h"
#include <limits.h>
#include <stdio.h>
#include "mgt/mgt.h"
......@@ -52,29 +51,29 @@
*/
struct parspec mgt_parspec[] = {
{ "user", tweak_user, NULL, 0, 0,
{ "user", tweak_user, NULL, NULL, NULL,
"The unprivileged user to run as.",
MUST_RESTART,
"" },
{ "group", tweak_group, NULL, 0, 0,
{ "group", tweak_group, NULL, NULL, NULL,
"The unprivileged group to run as.",
MUST_RESTART,
"" },
{ "default_ttl", tweak_timeout_double, &mgt_param.default_ttl,
0, UINT_MAX,
"0", NULL,
"The TTL assigned to objects if neither the backend nor "
"the VCL code assigns one.",
OBJ_STICKY,
"20", "seconds" },
{ "default_grace", tweak_timeout_double, &mgt_param.default_grace,
0, UINT_MAX,
"0", NULL,
"Default grace period. We will deliver an object "
"this long after it has expired, provided another thread "
"is attempting to get a new copy.",
OBJ_STICKY,
"10", "seconds" },
{ "default_keep", tweak_timeout_double, &mgt_param.default_keep,
0, UINT_MAX,
"0", NULL,
"Default keep period. We will keep a useless object "
"around this long, making it available for conditional "
"backend fetches. "
......@@ -83,19 +82,22 @@ struct parspec mgt_parspec[] = {
OBJ_STICKY,
"0", "seconds" },
{ "workspace_client",
tweak_bytes_u, &mgt_param.workspace_client, 3072, UINT_MAX,
tweak_bytes_u, &mgt_param.workspace_client,
"3072", NULL,
"Bytes of HTTP protocol workspace for clients HTTP req/resp."
" If larger than 4k, use a multiple of 4k for VM efficiency.",
DELAYED_EFFECT,
"64k", "bytes" },
{ "workspace_backend",
tweak_bytes_u, &mgt_param.workspace_backend, 1024, UINT_MAX,
tweak_bytes_u, &mgt_param.workspace_backend,
"1024", NULL,
"Bytes of HTTP protocol workspace for backend HTTP req/resp."
" If larger than 4k, use a multiple of 4k for VM efficiency.",
DELAYED_EFFECT,
"64k", "bytes" },
{ "workspace_thread",
tweak_bytes_u, &mgt_param.workspace_thread, 256, 8192,
tweak_bytes_u, &mgt_param.workspace_thread,
"256", "8192",
"Bytes of auxillary workspace per thread.\n"
"This workspace is used for certain temporary data structures"
" during the operation of a worker thread.\n"
......@@ -107,14 +109,14 @@ struct parspec mgt_parspec[] = {
"2048", "bytes" },
{ "http_req_hdr_len",
tweak_bytes_u, &mgt_param.http_req_hdr_len,
40, UINT_MAX,
"40", NULL,
"Maximum length of any HTTP client request header we will "
"allow. The limit is inclusive its continuation lines.",
0,
"8k", "bytes" },
{ "http_req_size",
tweak_bytes_u, &mgt_param.http_req_size,
256, UINT_MAX,
"256", NULL,
"Maximum number of bytes of HTTP client request we will deal "
"with. This is a limit on all bytes up to the double blank "
"line which ends the HTTP request.\n"
......@@ -125,14 +127,14 @@ struct parspec mgt_parspec[] = {
"32k", "bytes" },
{ "http_resp_hdr_len",
tweak_bytes_u, &mgt_param.http_resp_hdr_len,
40, UINT_MAX,
"40", NULL,
"Maximum length of any HTTP backend response header we will "
"allow. The limit is inclusive its continuation lines.",
0,
"8k", "bytes" },
{ "http_resp_size",
tweak_bytes_u, &mgt_param.http_resp_size,
256, UINT_MAX,
"256", NULL,
"Maximum number of bytes of HTTP backend resonse we will deal "
"with. This is a limit on all bytes up to the double blank "
"line which ends the HTTP request.\n"
......@@ -141,7 +143,8 @@ struct parspec mgt_parspec[] = {
"limits how much of that the request is allowed to take up.",
0,
"32k", "bytes" },
{ "http_max_hdr", tweak_uint, &mgt_param.http_max_hdr, 32, 65535,
{ "http_max_hdr", tweak_uint, &mgt_param.http_max_hdr,
"32", "65535",
"Maximum number of HTTP header lines we allow in "
"{req|resp|bereq|beresp}.http "
"(obj.http is autosized to the exact number of headers).\n"
......@@ -150,7 +153,8 @@ struct parspec mgt_parspec[] = {
0,
"64", "header lines" },
{ "vsl_buffer",
tweak_bytes_u, &mgt_param.vsl_buffer, 1024, UINT_MAX,
tweak_bytes_u, &mgt_param.vsl_buffer,
"1024", NULL,
"Bytes of (req-/backend-)workspace dedicated to buffering"
" VSL records.\n"
"At a bare minimum, this must be longer than"
......@@ -162,31 +166,34 @@ struct parspec mgt_parspec[] = {
0,
"4k", "bytes" },
{ "shm_reclen",
tweak_bytes_u, &mgt_param.shm_reclen, 16, 65535,
tweak_bytes_u, &mgt_param.shm_reclen,
"16", "65535",
"Maximum number of bytes in SHM log record.\n"
"Maximum is 65535 bytes.",
0,
"255", "bytes" },
{ "timeout_idle", tweak_timeout_double, &mgt_param.timeout_idle,
0, UINT_MAX,
"0", NULL,
"Idle timeout for client connections.\n"
"A connection is considered idle, until we receive"
" a non-white-space character on it.",
0,
"5", "seconds" },
{ "timeout_req", tweak_timeout_double, &mgt_param.timeout_req,
0, UINT_MAX,
"0", NULL,
"Max time to receive clients request header, measured"
" from first non-white-space character to double CRNL.",
0,
"2", "seconds" },
{ "pipe_timeout", tweak_timeout, &mgt_param.pipe_timeout, 0, 0,
{ "pipe_timeout", tweak_timeout, &mgt_param.pipe_timeout,
"0", NULL,
"Idle timeout for PIPE sessions. "
"If nothing have been received in either direction for "
"this many seconds, the session is closed.",
0,
"60", "seconds" },
{ "send_timeout", tweak_timeout, &mgt_param.send_timeout, 0, 0,
{ "send_timeout", tweak_timeout, &mgt_param.send_timeout,
"0", NULL,
"Send timeout for client connections. "
"If the HTTP response hasn't been transmitted in this many\n"
"seconds the session is closed.\n"
......@@ -194,7 +201,7 @@ struct parspec mgt_parspec[] = {
DELAYED_EFFECT,
"600", "seconds" },
{ "idle_send_timeout", tweak_timeout, &mgt_param.idle_send_timeout,
0, 0,
"0", NULL,
"Time to wait with no data sent. "
"If no data has been transmitted in this many\n"
"seconds the session is closed.\n"
......@@ -203,7 +210,7 @@ struct parspec mgt_parspec[] = {
"60", "seconds" },
#ifdef HAVE_TCP_KEEP
{ "tcp_keepalive_time", tweak_timeout, &mgt_param.tcp_keepalive_time,
1, 7200,
"1", "7200",
"The number of seconds a connection needs to be idle before "
"TCP begins sending out keep-alive probes. Note that this "
"setting will only take effect when it is less than the "
......@@ -211,7 +218,7 @@ struct parspec mgt_parspec[] = {
EXPERIMENTAL,
"600", "seconds" },
{ "tcp_keepalive_probes", tweak_uint, &mgt_param.tcp_keepalive_probes,
1, 100,
"1", "100",
"The maximum number of TCP keep-alive probes to send before "
"giving up and killing the connection if no response is "
"obtained from the other end. Note that this setting will "
......@@ -219,26 +226,28 @@ struct parspec mgt_parspec[] = {
EXPERIMENTAL,
"5", "probes" },
{ "tcp_keepalive_intvl", tweak_timeout, &mgt_param.tcp_keepalive_intvl,
1, 100,
"1", "100",
"The number of seconds between TCP keep-alive probes. Note "
"that this setting will only take effect when it is less than"
"the system default.",
EXPERIMENTAL,
"5", "seconds" },
#endif
{ "auto_restart", tweak_bool, &mgt_param.auto_restart, 0, 0,
{ "auto_restart", tweak_bool, &mgt_param.auto_restart,
NULL, NULL,
"Restart child process automatically if it dies.",
0,
"on", "bool" },
{ "nuke_limit",
tweak_uint, &mgt_param.nuke_limit, 0, UINT_MAX,
tweak_uint, &mgt_param.nuke_limit,
"0", NULL,
"Maximum number of objects we attempt to nuke in order"
"to make space for a object body.",
EXPERIMENTAL,
"50", "allocations" },
{ "fetch_chunksize",
tweak_bytes,
&mgt_param.fetch_chunksize, 4 * 1024, UINT_MAX,
tweak_bytes, &mgt_param.fetch_chunksize,
"4096", NULL,
"The default chunksize used by fetcher. "
"This should be bigger than the majority of objects with "
"short TTLs.\n"
......@@ -247,29 +256,33 @@ struct parspec mgt_parspec[] = {
EXPERIMENTAL,
"128k", "bytes" },
{ "fetch_maxchunksize",
tweak_bytes,
&mgt_param.fetch_maxchunksize, 64 * 1024, UINT_MAX,
tweak_bytes, &mgt_param.fetch_maxchunksize,
"65536", NULL,
"The maximum chunksize we attempt to allocate from storage. "
"Making this too large may cause delays and storage "
"fragmentation.",
EXPERIMENTAL,
"256m", "bytes" },
{ "accept_filter", tweak_bool, &mgt_param.accept_filter, 0, 0,
{ "accept_filter", tweak_bool, &mgt_param.accept_filter,
NULL, NULL,
"Enable kernel accept-filters, if supported by the kernel.",
MUST_RESTART,
"on", "bool" },
{ "listen_address", tweak_listen_address, NULL, 0, 0,
{ "listen_address", tweak_listen_address, NULL,
NULL, NULL,
"Whitespace separated list of network endpoints where "
"Varnish will accept requests.\n"
"Possible formats: host, host:port, :port",
MUST_RESTART,
":80" },
{ "listen_depth", tweak_uint, &mgt_param.listen_depth, 0, UINT_MAX,
{ "listen_depth", tweak_uint, &mgt_param.listen_depth,
"0", NULL,
"Listen queue depth.",
MUST_RESTART,
"1024", "connections" },
{ "cli_buffer",
tweak_bytes_u, &mgt_param.cli_buffer, 4096, UINT_MAX,
tweak_bytes_u, &mgt_param.cli_buffer,
"4096", NULL,
"Size of buffer for CLI command input."
"\nYou may need to increase this if you have big VCL files "
"and use the vcl.inline CLI command.\n"
......@@ -277,24 +290,28 @@ struct parspec mgt_parspec[] = {
0,
"8k", "bytes" },
{ "cli_limit",
tweak_bytes_u, &mgt_param.cli_limit, 128, 99999999,
tweak_bytes_u, &mgt_param.cli_limit,
"128", "99999999",
"Maximum size of CLI response. If the response exceeds"
" this limit, the reponse code will be 201 instead of"
" 200 and the last line will indicate the truncation.",
0,
"48k", "bytes" },
{ "cli_timeout", tweak_timeout, &mgt_param.cli_timeout, 0, 0,
{ "cli_timeout", tweak_timeout, &mgt_param.cli_timeout,
"0", NULL,
"Timeout for the childs replies to CLI requests from "
"the mgt_param.",
0,
"10", "seconds" },
{ "ping_interval", tweak_uint, &mgt_param.ping_interval, 0, UINT_MAX,
{ "ping_interval", tweak_uint, &mgt_param.ping_interval,
"0", NULL,
"Interval between pings from parent to child.\n"
"Zero will disable pinging entirely, which makes "
"it possible to attach a debugger to the child.",
MUST_RESTART,
"3", "seconds" },
{ "lru_interval", tweak_timeout, &mgt_param.lru_timeout, 0, 0,
{ "lru_interval", tweak_timeout, &mgt_param.lru_timeout,
"0", NULL,
"Grace period before object moves on LRU list.\n"
"Objects are only moved to the front of the LRU "
"list if they have not been moved there already inside "
......@@ -302,30 +319,33 @@ struct parspec mgt_parspec[] = {
"operations necessary for LRU list access.",
EXPERIMENTAL,
"2", "seconds" },
{ "cc_command", tweak_string, &mgt_cc_cmd, 0, 0,
{ "cc_command", tweak_string, &mgt_cc_cmd,
NULL, NULL,
"Command used for compiling the C source code to a "
"dlopen(3) loadable object. Any occurrence of %s in "
"the string will be replaced with the source file name, "
"and %o will be replaced with the output file name.",
MUST_RELOAD,
VCC_CC , NULL },
{ "max_restarts", tweak_uint, &mgt_param.max_restarts, 0, UINT_MAX,
{ "max_restarts", tweak_uint, &mgt_param.max_restarts,
"0", NULL,
"Upper limit on how many times a request can restart."
"\nBe aware that restarts are likely to cause a hit against "
"the backend, so don't increase thoughtlessly.",
0,
"4", "restarts" },
{ "max_retries", tweak_uint, &mgt_param.max_retries, 0, UINT_MAX,
{ "max_retries", tweak_uint, &mgt_param.max_retries,
"0", NULL,
"Upper limit on how many times a backend fetch can retry.",
0,
"4", "retries" },
{ "max_esi_depth",
tweak_uint, &mgt_param.max_esi_depth, 0, UINT_MAX,
{ "max_esi_depth", tweak_uint, &mgt_param.max_esi_depth,
"0", NULL,
"Maximum depth of esi:include processing.",
0,
"5", "levels" },
{ "connect_timeout", tweak_timeout_double,
&mgt_param.connect_timeout,0, UINT_MAX,
{ "connect_timeout", tweak_timeout_double, &mgt_param.connect_timeout,
"0", NULL,
"Default connection timeout for backend connections. "
"We only try to connect to the backend for this many "
"seconds before giving up. "
......@@ -334,7 +354,8 @@ struct parspec mgt_parspec[] = {
0,
"3.5", "s" },
{ "first_byte_timeout", tweak_timeout_double,
&mgt_param.first_byte_timeout,0, UINT_MAX,
&mgt_param.first_byte_timeout,
"0", NULL,
"Default timeout for receiving first byte from backend. "
"We only wait for this many seconds for the first "
"byte before giving up. A value of 0 means it will never time "
......@@ -344,7 +365,8 @@ struct parspec mgt_parspec[] = {
0,
"60", "s" },
{ "between_bytes_timeout", tweak_timeout_double,
&mgt_param.between_bytes_timeout,0, UINT_MAX,
&mgt_param.between_bytes_timeout,
"0", NULL,
"Default timeout between bytes when receiving data from "
"backend. "
"We only wait for this many seconds between bytes "
......@@ -354,7 +376,8 @@ struct parspec mgt_parspec[] = {
0,
"60", "s" },
{ "acceptor_sleep_max", tweak_timeout_double,
&mgt_param.acceptor_sleep_max, 0, 10,
&mgt_param.acceptor_sleep_max,
"0", "10",
"If we run out of resources, such as file descriptors or "
"worker threads, the acceptor will sleep between accepts.\n"
"This parameter limits how long it can sleep between "
......@@ -362,33 +385,38 @@ struct parspec mgt_parspec[] = {
EXPERIMENTAL,
"0.050", "s" },
{ "acceptor_sleep_incr", tweak_timeout_double,
&mgt_param.acceptor_sleep_incr, 0, 1,
&mgt_param.acceptor_sleep_incr,
"0", "1",
"If we run out of resources, such as file descriptors or "
"worker threads, the acceptor will sleep between accepts.\n"
"This parameter control how much longer we sleep, each time "
"we fail to accept a new connection.",
EXPERIMENTAL,
"0.001", "s" },
{ "acceptor_sleep_decay", tweak_generic_double,
&mgt_param.acceptor_sleep_decay, 0, 1,
{ "acceptor_sleep_decay", tweak_double,
&mgt_param.acceptor_sleep_decay,
"0", "1",
"If we run out of resources, such as file descriptors or "
"worker threads, the acceptor will sleep between accepts.\n"
"This parameter (multiplicatively) reduce the sleep duration "
"for each succesfull accept. (ie: 0.9 = reduce by 10%)",
EXPERIMENTAL,
"0.900", "" },
{ "clock_skew", tweak_uint, &mgt_param.clock_skew, 0, UINT_MAX,
{ "clock_skew", tweak_uint, &mgt_param.clock_skew,
"0", NULL,
"How much clockskew we are willing to accept between the "
"backend and our own clock.",
0,
"10", "s" },
{ "prefer_ipv6", tweak_bool, &mgt_param.prefer_ipv6, 0, 0,
{ "prefer_ipv6", tweak_bool, &mgt_param.prefer_ipv6,
NULL, NULL,
"Prefer IPv6 address when connecting to backends which "
"have both IPv4 and IPv6 addresses.",
0,
"off", "bool" },
{ "session_max", tweak_uint,
&mgt_param.max_sess, 1000, UINT_MAX,
&mgt_param.max_sess,
"1000", NULL,
"Maximum number of sessions we will allocate from one pool "
"before just dropping connections.\n"
"This is mostly an anti-DoS measure, and setting it plenty "
......@@ -397,7 +425,7 @@ struct parspec mgt_parspec[] = {
0,
"100000", "sessions" },
{ "timeout_linger", tweak_timeout_double, &mgt_param.timeout_linger,
0, UINT_MAX,
"0", NULL,
"How long time the workerthread lingers on an idle session "
"before handing it over to the waiter.\n"
"When sessions are reused, as much as half of all reuses "
......@@ -408,38 +436,45 @@ struct parspec mgt_parspec[] = {
"more sessions take a detour around the waiter.",
EXPERIMENTAL,
"0.050", "seconds" },
{ "log_local_address", tweak_bool, &mgt_param.log_local_addr, 0, 0,
{ "log_local_address", tweak_bool, &mgt_param.log_local_addr,
NULL, NULL,
"Log the local address on the TCP connection in the "
"SessionOpen VSL record.\n"
"Disabling this saves a getsockname(2) system call "
"per TCP connection.",
0,
"on", "bool" },
{ "waiter", tweak_waiter, NULL, 0, 0,
{ "waiter", tweak_waiter, NULL,
NULL, NULL,
"Select the waiter kernel interface.",
WIZARD | MUST_RESTART,
WAITER_DEFAULT, NULL },
{ "ban_dups", tweak_bool, &mgt_param.ban_dups, 0, 0,
{ "ban_dups", tweak_bool, &mgt_param.ban_dups,
NULL, NULL,
"Detect and eliminate duplicate bans.",
0,
"on", "bool" },
{ "syslog_cli_traffic", tweak_bool, &mgt_param.syslog_cli_traffic, 0, 0,
{ "syslog_cli_traffic", tweak_bool, &mgt_param.syslog_cli_traffic,
NULL, NULL,
"Log all CLI traffic to syslog(LOG_INFO).",
0,
"on", "bool" },
{ "ban_lurker_sleep", tweak_timeout_double,
&mgt_param.ban_lurker_sleep, 0, UINT_MAX,
&mgt_param.ban_lurker_sleep,
"0", NULL,
"How long time does the ban lurker thread sleeps between "
"successful attempts to push the last item up the ban "
" list. It always sleeps a second when nothing can be done.\n"
"A value of zero disables the ban lurker.",
0,
"0.01", "s" },
{ "http_range_support", tweak_bool, &mgt_param.http_range_support, 0, 0,
{ "http_range_support", tweak_bool, &mgt_param.http_range_support,
NULL, NULL,
"Enable support for HTTP Range headers.",
0,
"on", "bool" },
{ "http_gzip_support", tweak_bool, &mgt_param.http_gzip_support, 0, 0,
{ "http_gzip_support", tweak_bool, &mgt_param.http_gzip_support,
NULL, NULL,
"Enable gzip support. When enabled Varnish request compressed "
"objects from the backend and store them compressed. "
"If a client does not support gzip encoding Varnish will "
......@@ -453,18 +488,20 @@ struct parspec mgt_parspec[] = {
"Varnish reference.",
0,
"on", "bool" },
{ "gzip_level", tweak_uint, &mgt_param.gzip_level, 0, 9,
{ "gzip_level", tweak_uint, &mgt_param.gzip_level,
"0", "9",
"Gzip compression level: 0=debug, 1=fast, 9=best",
0,
"6", ""},
{ "gzip_memlevel", tweak_uint, &mgt_param.gzip_memlevel, 1, 9,
{ "gzip_memlevel", tweak_uint, &mgt_param.gzip_memlevel,
"1", "9",
"Gzip memory level 1=slow/least, 9=fast/most compression.\n"
"Memory impact is 1=1k, 2=2k, ... 9=256k.",
0,
"8", ""},
{ "gzip_buffer",
tweak_bytes_u, &mgt_param.gzip_buffer,
2048, UINT_MAX,
"2048", NULL,
"Size of malloc buffer used for gzip processing.\n"
"These buffers are used for in-transit data,"
" for instance gunzip'ed data being sent to a client."
......@@ -474,23 +511,27 @@ struct parspec mgt_parspec[] = {
EXPERIMENTAL,
"32k", "bytes" },
{ "shortlived", tweak_timeout_double,
&mgt_param.shortlived, 0, UINT_MAX,
&mgt_param.shortlived,
"0", NULL,
"Objects created with TTL shorter than this are always "
"put in transient storage.",
0,
"10.0", "s" },
{ "critbit_cooloff", tweak_timeout_double,
&mgt_param.critbit_cooloff, 60, 254,
&mgt_param.critbit_cooloff,
"60", "254",
"How long time the critbit hasher keeps deleted objheads "
"on the cooloff list.",
WIZARD,
"180.0", "s" },
{ "sigsegv_handler", tweak_bool, &mgt_param.sigsegv_handler, 0, 0,
"Install a signal handler which tries to dump debug information "
"on segmentation faults.",
{ "sigsegv_handler", tweak_bool, &mgt_param.sigsegv_handler,
NULL, NULL,
"Install a signal handler which tries to dump debug "
"information on segmentation faults.",
MUST_RESTART,
"off", "bool" },
{ "vcl_dir", tweak_string, &mgt_vcl_dir, 0, 0,
{ "vcl_dir", tweak_string, &mgt_vcl_dir,
NULL, NULL,
"Directory from which relative VCL filenames (vcl.load and "
"include) are opened.",
0,
......@@ -500,7 +541,8 @@ struct parspec mgt_parspec[] = {
".",
#endif
NULL },
{ "vmod_dir", tweak_string, &mgt_vmod_dir, 0, 0,
{ "vmod_dir", tweak_string, &mgt_vmod_dir,
NULL, NULL,
"Directory where VCL modules are to be found.",
0,
#ifdef VARNISH_VMOD_DIR
......@@ -510,17 +552,20 @@ struct parspec mgt_parspec[] = {
#endif
NULL },
{ "vcc_err_unref", tweak_bool, &mgt_vcc_err_unref, 0, 0,
{ "vcc_err_unref", tweak_bool, &mgt_vcc_err_unref,
NULL, NULL,
"Unreferenced VCL objects result in error.",
0,
"on", "bool" },
{ "vcc_allow_inline_c", tweak_bool, &mgt_vcc_allow_inline_c, 0, 0,
{ "vcc_allow_inline_c", tweak_bool, &mgt_vcc_allow_inline_c,
NULL, NULL,
"Allow inline C code in VCL.",
0,
"off", "bool" },
{ "vcc_unsafe_path", tweak_bool, &mgt_vcc_unsafe_path, 0, 0,
{ "vcc_unsafe_path", tweak_bool, &mgt_vcc_unsafe_path,
NULL, NULL,
"Allow '/' in vmod & include paths.\n"
"Allow 'import ... from ...'.",
0,
......@@ -528,7 +573,7 @@ struct parspec mgt_parspec[] = {
{ "pcre_match_limit", tweak_uint,
&mgt_param.vre_limits.match,
1, UINT_MAX,
"1", NULL,
"The limit for the number of internal matching function"
" calls in a pcre_exec() execution.",
0,
......@@ -536,14 +581,15 @@ struct parspec mgt_parspec[] = {
{ "pcre_match_limit_recursion", tweak_uint,
&mgt_param.vre_limits.match_recursion,
1, UINT_MAX,
"1", NULL,
"The limit for the number of internal matching function"
" recursions in a pcre_exec() execution.",
0,
"10000", ""},
{ "vsl_space", tweak_bytes,
&mgt_param.vsl_space, 1024*1024, 0,
&mgt_param.vsl_space,
"1M", NULL,
"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"
......@@ -553,7 +599,8 @@ struct parspec mgt_parspec[] = {
"80M", "bytes"},
{ "vsm_space", tweak_bytes,
&mgt_param.vsm_space, 1024*1024, 0,
&mgt_param.vsm_space,
"1M", NULL,
"The amount of space to allocate for stats counters"
" in the VSM memory segment."
" If you make this too small, some counters will be"
......@@ -563,30 +610,35 @@ struct parspec mgt_parspec[] = {
"1M", "bytes"},
{ "busyobj_worker_cache", tweak_bool,
&mgt_param.bo_cache, 0, 0,
&mgt_param.bo_cache,
NULL, NULL,
"Cache free busyobj per worker thread. "
"Disable this if you have very high hitrates and want "
"to save the memory of one busyobj per worker thread.",
0,
"off", "bool"},
{ "pool_vbc", tweak_poolparam, &mgt_param.vbc_pool, 0, 10000,
{ "pool_vbc", tweak_poolparam, &mgt_param.vbc_pool,
NULL, NULL,
"Parameters for backend connection memory pool.\n"
MEMPOOL_TEXT,
0,
"10,100,10", ""},
{ "pool_req", tweak_poolparam, &mgt_param.req_pool, 0, 10000,
{ "pool_req", tweak_poolparam, &mgt_param.req_pool,
NULL, NULL,
"Parameters for per worker pool request memory pool.\n"
MEMPOOL_TEXT,
0,
"10,100,10", ""},
{ "pool_sess", tweak_poolparam, &mgt_param.sess_pool, 0, 10000,
{ "pool_sess", tweak_poolparam, &mgt_param.sess_pool,
NULL, NULL,
"Parameters for per worker pool session memory pool.\n"
MEMPOOL_TEXT,
0,
"10,100,10", ""},
{ "pool_vbo", tweak_poolparam, &mgt_param.vbo_pool, 0, 10000,
{ "pool_vbo", tweak_poolparam, &mgt_param.vbo_pool,
NULL, NULL,
"Parameters for backend object fetch memory pool.\n"
MEMPOOL_TEXT,
0,
......
......@@ -56,68 +56,77 @@
#include "mgt_cli.h"
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------
* Generic handling of double typed parameters
*/
static int
tweak_generic_timeout(struct vsb *vsb, volatile unsigned *dst, const char *arg)
tweak_generic_double(struct vsb *vsb, volatile double *dest,
const char *arg, const char *min, const char *max, const char *fmt)
{
unsigned u;
double u, minv = 0, maxv = 0;
char *p;
if (arg != NULL) {
u = strtoul(arg, NULL, 0);
if (u == 0) {
VSB_printf(vsb, "Timeout must be greater than zero\n");
if (min != NULL) {
p = NULL;
minv = strtod(min, &p);
if (*arg == '\0' || *p != '\0') {
VSB_printf(vsb, "Illegal Min: %s\n", min);
return (-1);
}
*dst = u;
} else
VSB_printf(vsb, "%u", *dst);
return (0);
}
/*--------------------------------------------------------------------*/
int
tweak_timeout(struct vsb *vsb, const struct parspec *par, const char *arg)
{
volatile unsigned *dest;
dest = par->priv;
return (tweak_generic_timeout(vsb, dest, arg));
}
/*--------------------------------------------------------------------*/
static int
tweak_generic_timeout_double(struct vsb *vsb, volatile double *dest,
const char *arg, double min, double max)
{
double u;
char *p;
}
if (max != NULL) {
p = NULL;
maxv = strtod(max, &p);
if (*arg == '\0' || *p != '\0') {
VSB_printf(vsb, "Illegal Max: %s\n", max);
return (-1);
}
}
if (arg != NULL) {
p = NULL;
u = strtod(arg, &p);
if (*arg == '\0' || *p != '\0') {
VSB_printf(vsb, "Not a number(%s)\n", arg);
return (-1);
}
if (u < min) {
if (min != NULL && u < minv) {
VSB_printf(vsb,
"Timeout must be greater or equal to %.g\n", min);
"Timeout must be greater or equal to %s\n", min);
return (-1);
}
if (u > max) {
if (max != NULL && u > maxv) {
VSB_printf(vsb,
"Timeout must be less than or equal to %.g\n", max);
"Timeout must be less than or equal to %s\n", max);
return (-1);
}
*dest = u;
} else
VSB_printf(vsb, "%.6f", *dest);
VSB_printf(vsb, fmt, *dest);
return (0);
}
/*--------------------------------------------------------------------*/
int
tweak_timeout(struct vsb *vsb, const struct parspec *par, const char *arg)
{
int i;
double d;
volatile unsigned *dest;
dest = par->priv;
d = *dest;
i = tweak_generic_double(vsb, &d, arg, par->min, par->max, "%.0f");
if (!i) {
*dest = (unsigned)ceil(d);
}
return (i);
}
/*--------------------------------------------------------------------*/
int
tweak_timeout_double(struct vsb *vsb, const struct parspec *par,
const char *arg)
......@@ -125,45 +134,20 @@ tweak_timeout_double(struct vsb *vsb, const struct parspec *par,
volatile double *dest;
dest = par->priv;
return (tweak_generic_timeout_double(vsb, dest, arg,
par->min, par->max));
return (tweak_generic_double(vsb, dest, arg,
par->min, par->max, "%.3f"));
}
/*--------------------------------------------------------------------*/
int
tweak_generic_double(struct vsb *vsb, const struct parspec *par,
const char *arg)
tweak_double(struct vsb *vsb, const struct parspec *par, const char *arg)
{
volatile double *dest;
char *p;
double u;
dest = par->priv;
if (arg != NULL) {
p = NULL;
u = strtod(arg, &p);
if (*p != '\0') {
VSB_printf(vsb,
"Not a number (%s)\n", arg);
return (-1);
}
if (u < par->min) {
VSB_printf(vsb,
"Must be greater or equal to %.g\n",
par->min);
return (-1);
}
if (u > par->max) {
VSB_printf(vsb,
"Must be less than or equal to %.g\n",
par->max);
return (-1);
}
*dest = u;
} else
VSB_printf(vsb, "%f", *dest);
return (0);
return (tweak_generic_double(vsb, dest, arg,
par->min, par->max, "%g"));
}
/*--------------------------------------------------------------------*/
......@@ -214,12 +198,28 @@ tweak_bool(struct vsb *vsb, const struct parspec *par, const char *arg)
int
tweak_generic_uint(struct vsb *vsb, volatile unsigned *dest, const char *arg,
unsigned min, unsigned max)
const char *min, const char *max)
{
unsigned u;
unsigned u, minv = 0, maxv = 0;
char *p;
if (arg != NULL) {
if (min != NULL) {
p = NULL;
minv = strtoul(min, &p, 0);
if (*arg == '\0' || *p != '\0') {
VSB_printf(vsb, "Illegal Min: %s\n", min);
return (-1);
}
}
if (max != NULL) {
p = NULL;
maxv = strtoul(max, &p, 0);
if (*arg == '\0' || *p != '\0') {
VSB_printf(vsb, "Illegal Max: %s\n", max);
return (-1);
}
}
p = NULL;
if (!strcasecmp(arg, "unlimited"))
u = UINT_MAX;
......@@ -230,12 +230,12 @@ tweak_generic_uint(struct vsb *vsb, volatile unsigned *dest, const char *arg,
return (-1);
}
}
if (u < min) {
VSB_printf(vsb, "Must be at least %u\n", min);
if (min != NULL && u < minv) {
VSB_printf(vsb, "Must be at least %s\n", min);
return (-1);
}
if (u > max) {
VSB_printf(vsb, "Must be no more than %u\n", max);
if (max != NULL && u > maxv) {
VSB_printf(vsb, "Must be no more than %s\n", max);
return (-1);
}
*dest = u;
......@@ -255,9 +255,7 @@ tweak_uint(struct vsb *vsb, const struct parspec *par, const char *arg)
volatile unsigned *dest;
dest = par->priv;
(void)tweak_generic_uint(vsb, dest, arg,
(uint)par->min, (uint)par->max);
return (0);
return (tweak_generic_uint(vsb, dest, arg, par->min, par->max));
}
/*--------------------------------------------------------------------*/
......@@ -287,12 +285,26 @@ fmt_bytes(struct vsb *vsb, uintmax_t t)
static int
tweak_generic_bytes(struct vsb *vsb, volatile ssize_t *dest, const char *arg,
double min, double max)
const char *min, const char *max)
{
uintmax_t r;
uintmax_t r, rmin = 0, rmax = 0;
const char *p;
if (arg != NULL) {
if (min != NULL) {
p = VNUM_2bytes(min, &rmin, 0);
if (p != NULL) {
VSB_printf(vsb, "Invalid min-val: %s\n", min);
return (-1);
}
}
if (max != NULL) {
p = VNUM_2bytes(max, &rmax, 0);
if (p != NULL) {
VSB_printf(vsb, "Invalid max-val: %s\n", max);
return (-1);
}
}
p = VNUM_2bytes(arg, &r, 0);
if (p != NULL) {
VSB_printf(vsb, "Could not convert to bytes.\n");
......@@ -303,19 +315,17 @@ tweak_generic_bytes(struct vsb *vsb, volatile ssize_t *dest, const char *arg,
}
if ((uintmax_t)((ssize_t)r) != r) {
fmt_bytes(vsb, r);
VSB_printf(vsb, " is too large for this architecture.\n");
VSB_printf(vsb,
" is too large for this architecture.\n");
return (-1);
}
if (max != 0. && r > max) {
VSB_printf(vsb, "Must be no more than ");
fmt_bytes(vsb, (uintmax_t)max);
if (max != NULL && r > rmax) {
VSB_printf(vsb, "Must be no more than %s\n", max);
VSB_printf(vsb, "\n");
return (-1);
}
if (r < min) {
VSB_printf(vsb, "Must be at least ");
fmt_bytes(vsb, (uintmax_t)min);
VSB_printf(vsb, "\n");
if (min != NULL && r < rmin) {
VSB_printf(vsb, "Must be at least %s\n", min);
return (-1);
}
*dest = r;
......@@ -332,12 +342,10 @@ tweak_bytes(struct vsb *vsb, const struct parspec *par, const char *arg)
{
volatile ssize_t *dest;
assert(par->min >= 0);
dest = par->priv;
return (tweak_generic_bytes(vsb, dest, arg, par->min, par->max));
}
/*--------------------------------------------------------------------*/
int
......@@ -346,8 +354,6 @@ tweak_bytes_u(struct vsb *vsb, const struct parspec *par, const char *arg)
volatile unsigned *d1;
volatile ssize_t dest;
assert(par->max <= UINT_MAX);
assert(par->min >= 0);
d1 = par->priv;
dest = *d1;
if (tweak_generic_bytes(vsb, &dest, arg, par->min, par->max))
......@@ -568,15 +574,15 @@ tweak_poolparam(struct vsb *vsb, const struct parspec *par, const char *arg)
}
px = *pp;
retval = tweak_generic_uint(vsb, &px.min_pool, av[1],
(uint)par->min, (uint)par->max);
par->min, par->max);
if (retval)
break;
retval = tweak_generic_uint(vsb, &px.max_pool, av[2],
(uint)par->min, (uint)par->max);
par->min, par->max);
if (retval)
break;
retval = tweak_generic_timeout_double(vsb,
&px.max_age, av[3], 0, 1e6);
retval = tweak_generic_double(vsb,
&px.max_age, av[3], "0", "1e6", "%.0f");
if (retval)
break;
if (px.min_pool > px.max_pool) {
......
......@@ -42,7 +42,6 @@
#include "config.h"
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
......@@ -60,7 +59,8 @@ tweak_thread_pool_min(struct vsb *vsb, const struct parspec *par,
{
return (tweak_generic_uint(vsb, &mgt_param.wthread_min, arg,
(unsigned)par->min, mgt_param.wthread_max));
// par->min, mgt_param.wthread_max));
par->min, NULL));
}
/*--------------------------------------------------------------------
......@@ -93,14 +93,15 @@ tweak_thread_pool_max(struct vsb *vsb, const struct parspec *par,
(void)par;
return (tweak_generic_uint(vsb, &mgt_param.wthread_max, arg,
mgt_param.wthread_min, UINT_MAX));
//mgt_param.wthread_min, NULL));
NULL, NULL));
}
/*--------------------------------------------------------------------*/
struct parspec WRK_parspec[] = {
{ "thread_pools", tweak_uint, &mgt_param.wthread_pools,
1, UINT_MAX,
"1", NULL,
"Number of worker thread pools.\n"
"\n"
"Increasing number of worker pools decreases lock "
......@@ -113,7 +114,8 @@ struct parspec WRK_parspec[] = {
"restart to take effect.",
EXPERIMENTAL | DELAYED_EFFECT,
"2", "pools" },
{ "thread_pool_max", tweak_thread_pool_max, NULL, 10, 0,
{ "thread_pool_max", tweak_thread_pool_max, NULL,
"10", NULL,
"The maximum number of worker threads in each pool.\n"
"\n"
"Do not set this higher than you have to, since excess "
......@@ -123,7 +125,8 @@ struct parspec WRK_parspec[] = {
"Minimum is 10 threads.",
DELAYED_EFFECT,
"5000", "threads" },
{ "thread_pool_min", tweak_thread_pool_min, NULL, 10, 0,
{ "thread_pool_min", tweak_thread_pool_min, NULL,
"10", NULL,
"The minimum number of worker threads in each pool.\n"
"\n"
"Increasing this may help ramp up faster from low load "
......@@ -134,7 +137,7 @@ struct parspec WRK_parspec[] = {
"100", "threads" },
{ "thread_pool_timeout",
tweak_timeout_double, &mgt_param.wthread_timeout,
10, UINT_MAX,
"10", NULL,
"Thread idle threshold.\n"
"\n"
"Threads in excess of thread_pool_min, which have been idle "
......@@ -145,7 +148,7 @@ struct parspec WRK_parspec[] = {
"300", "seconds" },
{ "thread_pool_destroy_delay",
tweak_timeout_double, &mgt_param.wthread_destroy_delay,
0.01, UINT_MAX,
"0.01", NULL,
"Wait this long after destroying a thread.\n"
"\n"
"This controls the decay of thread pools when idle(-ish).\n"
......@@ -155,7 +158,7 @@ struct parspec WRK_parspec[] = {
"1", "seconds" },
{ "thread_pool_add_delay",
tweak_timeout_double, &mgt_param.wthread_add_delay,
0, UINT_MAX,
"0", NULL,
"Wait at least this long after creating a thread.\n"
"\n"
"Some (buggy) systems may need a short (sub-second) "
......@@ -168,7 +171,7 @@ struct parspec WRK_parspec[] = {
"0", "seconds" },
{ "thread_pool_fail_delay",
tweak_timeout_double, &mgt_param.wthread_fail_delay,
10e-3, UINT_MAX,
"10e-3", NULL,
"Wait at least this long after a failed thread creation "
"before trying to create another thread.\n"
"\n"
......@@ -186,7 +189,8 @@ struct parspec WRK_parspec[] = {
EXPERIMENTAL,
"0.2", "seconds" },
{ "thread_stats_rate",
tweak_uint, &mgt_param.wthread_stats_rate, 0, UINT_MAX,
tweak_uint, &mgt_param.wthread_stats_rate,
"0", NULL,
"Worker threads accumulate statistics, and dump these into "
"the global stats counters if the lock is free when they "
"finish a request.\n"
......@@ -196,7 +200,7 @@ struct parspec WRK_parspec[] = {
EXPERIMENTAL,
"10", "requests" },
{ "thread_queue_limit", tweak_uint, &mgt_param.wthread_queue_limit,
0, UINT_MAX,
"0", NULL,
"Permitted queue length per thread-pool.\n"
"\n"
"This sets the number of requests we will queue, waiting "
......@@ -204,7 +208,8 @@ struct parspec WRK_parspec[] = {
"be dropped instead of queued.",
EXPERIMENTAL,
"20", "" },
{ "rush_exponent", tweak_uint, &mgt_param.rush_exponent, 2, UINT_MAX,
{ "rush_exponent", tweak_uint, &mgt_param.rush_exponent,
"2", NULL,
"How many parked request we start for each completed "
"request on the object.\n"
"NB: Even with the implict delay of delivery, "
......@@ -213,7 +218,8 @@ struct parspec WRK_parspec[] = {
EXPERIMENTAL,
"3", "requests per request" },
{ "thread_pool_stack",
tweak_stack_size, &mgt_param.wthread_stacksize, 0, UINT_MAX,
tweak_stack_size, &mgt_param.wthread_stacksize,
"0", NULL,
"Worker thread stack size.\n"
"This is likely rounded up to a multiple of 4k by the kernel.\n"
"The kernel/OS has a lower limit which will be enforced.",
......
......@@ -15,7 +15,9 @@ Enable kernel accept-filters, if supported by the kernel.
acceptor_sleep_decay
~~~~~~~~~~~~~~~~~~~~
* Default: 0.900
* Default: 0.9
* Minimum: 0
* Maximum: 1
* Flags: experimental
If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts.
......@@ -26,7 +28,9 @@ This parameter (multiplicatively) reduce the sleep duration for each succesfull
acceptor_sleep_incr
~~~~~~~~~~~~~~~~~~~
* Units: s
* Default: 0.001
* Default: 0.001000
* Minimum: 0.000000
* Maximum: 1.000000
* Flags: experimental
If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts.
......@@ -37,7 +41,9 @@ This parameter control how much longer we sleep, each time we fail to accept a n
acceptor_sleep_max
~~~~~~~~~~~~~~~~~~
* Units: s
* Default: 0.050
* Default: 0.050000
* Minimum: 0.000000
* Maximum: 10.000000
* Flags: experimental
If we run out of resources, such as file descriptors or worker threads, the acceptor will sleep between accepts.
......@@ -66,7 +72,8 @@ Detect and eliminate duplicate bans.
ban_lurker_sleep
~~~~~~~~~~~~~~~~
* Units: s
* Default: 0.01
* Default: 0.010000
* Minimum: 0.000000
How long time does the ban lurker thread sleeps between successful attempts to push the last item up the ban list. It always sleeps a second when nothing can be done.
A value of zero disables the ban lurker.
......@@ -76,7 +83,8 @@ A value of zero disables the ban lurker.
between_bytes_timeout
~~~~~~~~~~~~~~~~~~~~~
* Units: s
* Default: 60
* Default: 60.000000
* Minimum: 0.000000
Default timeout between bytes when receiving data from backend. We only wait for this many seconds between bytes before giving up. A value of 0 means it will never time out. VCL can override this default value for each backend request and backend request. This parameter does not apply to pipe.
......@@ -93,7 +101,7 @@ Cache free busyobj per worker thread. Disable this if you have very high hitrate
cc_command
~~~~~~~~~~
* Default: exec clang -std=gnu99 -Qunused-arguments -D_THREAD_SAFE -pthread -fpic -shared -Wl,-x -o %o %s
* Default: "exec clang -std=gnu99 -Qunused-arguments -D_THREAD_SAFE -pthread -fpic -shared -Wl,-x -o %o %s"
* Flags: must_reload
Command used for compiling the C source code to a dlopen(3) loadable object. Any occurrence of %s in the string will be replaced with the source file name, and %o will be replaced with the output file name.
......@@ -104,6 +112,7 @@ cli_buffer
~~~~~~~~~~
* Units: bytes
* Default: 8k
* Minimum: 4k
Size of buffer for CLI command input.
You may need to increase this if you have big VCL files and use the vcl.inline CLI command.
......@@ -115,6 +124,8 @@ cli_limit
~~~~~~~~~
* Units: bytes
* Default: 48k
* Minimum: 128b
* Maximum: 99999999b
Maximum size of CLI response. If the response exceeds this limit, the reponse code will be 201 instead of 200 and the last line will indicate the truncation.
......@@ -124,6 +135,7 @@ cli_timeout
~~~~~~~~~~~
* Units: seconds
* Default: 10
* Minimum: 0
Timeout for the childs replies to CLI requests from the mgt_param.
......@@ -133,6 +145,7 @@ clock_skew
~~~~~~~~~~
* Units: s
* Default: 10
* Minimum: 0
How much clockskew we are willing to accept between the backend and our own clock.
......@@ -141,7 +154,8 @@ How much clockskew we are willing to accept between the backend and our own cloc
connect_timeout
~~~~~~~~~~~~~~~
* Units: s
* Default: 3.5
* Default: 3.500000
* Minimum: 0.000000
Default connection timeout for backend connections. We only try to connect to the backend for this many seconds before giving up. VCL can override this default value for each backend and backend request.
......@@ -150,7 +164,9 @@ Default connection timeout for backend connections. We only try to connect to th
critbit_cooloff
~~~~~~~~~~~~~~~
* Units: s
* Default: 180.0
* Default: 180.000000
* Minimum: 60.000000
* Maximum: 254.000000
* Flags: wizard
How long time the critbit hasher keeps deleted objheads on the cooloff list.
......@@ -200,7 +216,8 @@ Use +/- prefix to set/reset individual bits:
default_grace
~~~~~~~~~~~~~
* Units: seconds
* Default: 10
* Default: 10.000000
* Minimum: 0.000000
* Flags:
Default grace period. We will deliver an object this long after it has expired, provided another thread is attempting to get a new copy.
......@@ -210,7 +227,8 @@ Default grace period. We will deliver an object this long after it has expired,
default_keep
~~~~~~~~~~~~
* Units: seconds
* Default: 0
* Default: 0.000000
* Minimum: 0.000000
* Flags:
Default keep period. We will keep a useless object around this long, making it available for conditional backend fetches. That means that the object will be removed from the cache at the end of ttl+grace+keep.
......@@ -220,7 +238,8 @@ Default keep period. We will keep a useless object around this long, making it
default_ttl
~~~~~~~~~~~
* Units: seconds
* Default: 120
* Default: 20.000000
* Minimum: 0.000000
* Flags:
The TTL assigned to objects if neither the backend nor the VCL code assigns one.
......@@ -265,6 +284,7 @@ fetch_chunksize
~~~~~~~~~~~~~~~
* Units: bytes
* Default: 128k
* Minimum: 4k
* Flags: experimental
The default chunksize used by fetcher. This should be bigger than the majority of objects with short TTLs.
......@@ -275,7 +295,8 @@ Internal limits in the storage_file module makes increases above 128kb a dubious
fetch_maxchunksize
~~~~~~~~~~~~~~~~~~
* Units: bytes
* Default: 256m
* Default: 0.25G
* Minimum: 64k
* Flags: experimental
The maximum chunksize we attempt to allocate from storage. Making this too large may cause delays and storage fragmentation.
......@@ -285,7 +306,8 @@ The maximum chunksize we attempt to allocate from storage. Making this too large
first_byte_timeout
~~~~~~~~~~~~~~~~~~
* Units: s
* Default: 60
* Default: 60.000000
* Minimum: 0.000000
Default timeout for receiving first byte from backend. We only wait for this many seconds for the first byte before giving up. A value of 0 means it will never time out. VCL can override this default value for each backend and backend request. This parameter does not apply to pipe.
......@@ -293,7 +315,7 @@ Default timeout for receiving first byte from backend. We only wait for this man
group
~~~~~
* Default: nogroup
* Default: nogroup (65533)
* Flags: must_restart
The unprivileged group to run as.
......@@ -304,6 +326,7 @@ gzip_buffer
~~~~~~~~~~~
* Units: bytes
* Default: 32k
* Minimum: 2k
* Flags: experimental
Size of malloc buffer used for gzip processing.
......@@ -314,6 +337,8 @@ These buffers are used for in-transit data, for instance gunzip'ed data being se
gzip_level
~~~~~~~~~~
* Default: 6
* Minimum: 0
* Maximum: 9
Gzip compression level: 0=debug, 1=fast, 9=best
......@@ -322,6 +347,8 @@ Gzip compression level: 0=debug, 1=fast, 9=best
gzip_memlevel
~~~~~~~~~~~~~
* Default: 8
* Minimum: 1
* Maximum: 9
Gzip memory level 1=slow/least, 9=fast/most compression.
Memory impact is 1=1k, 2=2k, ... 9=256k.
......@@ -344,6 +371,8 @@ http_max_hdr
~~~~~~~~~~~~
* Units: header lines
* Default: 64
* Minimum: 32
* Maximum: 65535
Maximum number of HTTP header lines we allow in {req|resp|bereq|beresp}.http (obj.http is autosized to the exact number of headers).
Cheap, ~20 bytes, in terms of workspace memory.
......@@ -364,6 +393,7 @@ http_req_hdr_len
~~~~~~~~~~~~~~~~
* Units: bytes
* Default: 8k
* Minimum: 40b
Maximum length of any HTTP client request header we will allow. The limit is inclusive its continuation lines.
......@@ -373,6 +403,7 @@ http_req_size
~~~~~~~~~~~~~
* Units: bytes
* Default: 32k
* Minimum: 0.25k
Maximum number of bytes of HTTP client request we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request.
The memory for the request is allocated from the client workspace (param: workspace_client) and this parameter limits how much of that the request is allowed to take up.
......@@ -383,6 +414,7 @@ http_resp_hdr_len
~~~~~~~~~~~~~~~~~
* Units: bytes
* Default: 8k
* Minimum: 40b
Maximum length of any HTTP backend response header we will allow. The limit is inclusive its continuation lines.
......@@ -392,6 +424,7 @@ http_resp_size
~~~~~~~~~~~~~~
* Units: bytes
* Default: 32k
* Minimum: 0.25k
Maximum number of bytes of HTTP backend resonse we will deal with. This is a limit on all bytes up to the double blank line which ends the HTTP request.
The memory for the request is allocated from the worker workspace (param: thread_pool_workspace) and this parameter limits how much of that the request is allowed to take up.
......@@ -402,6 +435,7 @@ idle_send_timeout
~~~~~~~~~~~~~~~~~
* Units: seconds
* Default: 60
* Minimum: 0
* Flags: delayed
Time to wait with no data sent. If no data has been transmitted in this many
......@@ -424,6 +458,7 @@ listen_depth
~~~~~~~~~~~~
* Units: connections
* Default: 1024
* Minimum: 0
* Flags: must_restart
Listen queue depth.
......@@ -444,6 +479,7 @@ lru_interval
~~~~~~~~~~~~
* Units: seconds
* Default: 2
* Minimum: 0
* Flags: experimental
Grace period before object moves on LRU list.
......@@ -455,6 +491,7 @@ max_esi_depth
~~~~~~~~~~~~~
* Units: levels
* Default: 5
* Minimum: 0
Maximum depth of esi:include processing.
......@@ -464,6 +501,7 @@ max_restarts
~~~~~~~~~~~~
* Units: restarts
* Default: 4
* Minimum: 0
Upper limit on how many times a request can restart.
Be aware that restarts are likely to cause a hit against the backend, so don't increase thoughtlessly.
......@@ -474,6 +512,7 @@ max_retries
~~~~~~~~~~~
* Units: retries
* Default: 4
* Minimum: 0
Upper limit on how many times a backend fetch can retry.
......@@ -483,6 +522,7 @@ nuke_limit
~~~~~~~~~~
* Units: allocations
* Default: 50
* Minimum: 0
* Flags: experimental
Maximum number of objects we attempt to nuke in orderto make space for a object body.
......@@ -492,6 +532,7 @@ Maximum number of objects we attempt to nuke in orderto make space for a object
pcre_match_limit
~~~~~~~~~~~~~~~~
* Default: 10000
* Minimum: 1
The limit for the number of internal matching function calls in a pcre_exec() execution.
......@@ -500,6 +541,7 @@ The limit for the number of internal matching function calls in a pcre_exec() e
pcre_match_limit_recursion
~~~~~~~~~~~~~~~~~~~~~~~~~~
* Default: 10000
* Minimum: 1
The limit for the number of internal matching function recursions in a pcre_exec() execution.
......@@ -509,6 +551,7 @@ ping_interval
~~~~~~~~~~~~~
* Units: seconds
* Default: 3
* Minimum: 0
* Flags: must_restart
Interval between pings from parent to child.
......@@ -520,6 +563,7 @@ pipe_timeout
~~~~~~~~~~~~
* Units: seconds
* Default: 60
* Minimum: 0
Idle timeout for PIPE sessions. If nothing have been received in either direction for this many seconds, the session is closed.
......@@ -610,6 +654,7 @@ rush_exponent
~~~~~~~~~~~~~
* Units: requests per request
* Default: 3
* Minimum: 2
* Flags: experimental
How many parked request we start for each completed request on the object.
......@@ -621,6 +666,7 @@ send_timeout
~~~~~~~~~~~~
* Units: seconds
* Default: 600
* Minimum: 0
* Flags: delayed
Send timeout for client connections. If the HTTP response hasn't been transmitted in this many
......@@ -633,6 +679,7 @@ session_max
~~~~~~~~~~~
* Units: sessions
* Default: 100000
* Minimum: 1000
Maximum number of sessions we will allocate from one pool before just dropping connections.
This is mostly an anti-DoS measure, and setting it plenty high should not hurt, as long as you have the memory for it.
......@@ -642,7 +689,9 @@ This is mostly an anti-DoS measure, and setting it plenty high should not hurt,
shm_reclen
~~~~~~~~~~
* Units: bytes
* Default: 255
* Default: 255b
* Minimum: 16b
* Maximum: 65535b
Maximum number of bytes in SHM log record.
Maximum is 65535 bytes.
......@@ -652,7 +701,8 @@ Maximum is 65535 bytes.
shortlived
~~~~~~~~~~
* Units: s
* Default: 10.0
* Default: 10.000000
* Minimum: 0.000000
Objects created with TTL shorter than this are always put in transient storage.
......@@ -681,6 +731,8 @@ tcp_keepalive_intvl
~~~~~~~~~~~~~~~~~~~
* Units: seconds
* Default: 5
* Minimum: 1
* Maximum: 100
* Flags: experimental
The number of seconds between TCP keep-alive probes. Note that this setting will only take effect when it is less thanthe system default.
......@@ -691,6 +743,8 @@ tcp_keepalive_probes
~~~~~~~~~~~~~~~~~~~~
* Units: probes
* Default: 5
* Minimum: 1
* Maximum: 100
* Flags: experimental
The maximum number of TCP keep-alive probes to send before giving up and killing the connection if no response is obtained from the other end. Note that this setting will only take effect when it is less than the system default.
......@@ -701,6 +755,8 @@ tcp_keepalive_time
~~~~~~~~~~~~~~~~~~
* Units: seconds
* Default: 600
* Minimum: 1
* Maximum: 7200
* Flags: experimental
The number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes. Note that this setting will only take effect when it is less than the system default.
......@@ -710,7 +766,8 @@ The number of seconds a connection needs to be idle before TCP begins sending ou
thread_pool_add_delay
~~~~~~~~~~~~~~~~~~~~~
* Units: seconds
* Default: 0
* Default: 0.000000
* Minimum: 0.000000
* Flags: experimental
Wait at least this long after creating a thread.
......@@ -725,7 +782,8 @@ Setting this too high results in insuffient worker threads.
thread_pool_destroy_delay
~~~~~~~~~~~~~~~~~~~~~~~~~
* Units: seconds
* Default: 1
* Default: 1.000000
* Minimum: 0.010000
* Flags: delayed, experimental
Wait this long after destroying a thread.
......@@ -739,7 +797,8 @@ Minimum is 0.01 second.
thread_pool_fail_delay
~~~~~~~~~~~~~~~~~~~~~~
* Units: seconds
* Default: 0.2
* Default: 0.200000
* Minimum: 0.010000
* Flags: experimental
Wait at least this long after a failed thread creation before trying to create another thread.
......@@ -756,6 +815,7 @@ thread_pool_max
~~~~~~~~~~~~~~~
* Units: threads
* Default: 5000
* Minimum: 10
* Flags: delayed
The maximum number of worker threads in each pool.
......@@ -770,6 +830,7 @@ thread_pool_min
~~~~~~~~~~~~~~~
* Units: threads
* Default: 100
* Minimum: 10
* Flags: delayed
The minimum number of worker threads in each pool.
......@@ -784,6 +845,7 @@ thread_pool_stack
~~~~~~~~~~~~~~~~~
* Units: bytes
* Default: 48k
* Minimum: 2k
* Flags: experimental
Worker thread stack size.
......@@ -795,7 +857,8 @@ The kernel/OS has a lower limit which will be enforced.
thread_pool_timeout
~~~~~~~~~~~~~~~~~~~
* Units: seconds
* Default: 300
* Default: 300.000000
* Minimum: 10.000000
* Flags: delayed, experimental
Thread idle threshold.
......@@ -810,6 +873,7 @@ thread_pools
~~~~~~~~~~~~
* Units: pools
* Default: 2
* Minimum: 1
* Flags: delayed, experimental
Number of worker thread pools.
......@@ -825,6 +889,7 @@ Can be increased on the fly, but decreases require a restart to take effect.
thread_queue_limit
~~~~~~~~~~~~~~~~~~
* Default: 20
* Minimum: 0
* Flags: experimental
Permitted queue length per thread-pool.
......@@ -837,6 +902,7 @@ 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 request.
......@@ -847,7 +913,8 @@ This parameters defines the maximum number of requests a worker thread may handl
timeout_idle
~~~~~~~~~~~~
* Units: seconds
* Default: 5
* Default: 5.000000
* Minimum: 0.000000
Idle timeout for client connections.
A connection is considered idle, until we receive a non-white-space character on it.
......@@ -857,7 +924,8 @@ A connection is considered idle, until we receive a non-white-space character on
timeout_linger
~~~~~~~~~~~~~~
* Units: seconds
* Default: 0.050
* Default: 0.050000
* Minimum: 0.000000
* Flags: experimental
How long time the workerthread lingers on an idle session before handing it over to the waiter.
......@@ -869,7 +937,8 @@ Setting this too high results in worker threads not doing anything for their kee
timeout_req
~~~~~~~~~~~
* Units: seconds
* Default: 2
* Default: 2.000000
* Minimum: 0.000000
Max time to receive clients request header, measured from first non-white-space character to double CRNL.
......@@ -877,7 +946,7 @@ Max time to receive clients request header, measured from first non-white-space
user
~~~~
* Default: nobody
* Default: nobody (65534)
* Flags: must_restart
The unprivileged user to run as.
......@@ -932,6 +1001,7 @@ vsl_buffer
~~~~~~~~~~
* Units: bytes
* Default: 4k
* Minimum: 1k
Bytes of (req-/backend-)workspace dedicated to buffering VSL records.
At a bare minimum, this must be longer than the longest HTTP header to be logged.
......@@ -942,7 +1012,7 @@ Minimum is 1k bytes.
vsl_mask
~~~~~~~~
* Default: default
* Default: -VCL_trace,-WorkThread,-Hash
Mask individual VSL messages from being logged.
......@@ -957,6 +1027,7 @@ vsl_space
~~~~~~~~~
* Units: bytes
* Default: 80M
* Minimum: 1M
* 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.
......@@ -967,6 +1038,7 @@ vsm_space
~~~~~~~~~
* Units: bytes
* Default: 1M
* Minimum: 1M
* Flags: must_restart
The amount of space to allocate for stats counters in the VSM memory segment. If you make this too small, some counters will be invisible. Making it too large just costs memory resources.
......@@ -975,7 +1047,7 @@ The amount of space to allocate for stats counters in the VSM memory segment. I
waiter
~~~~~~
* Default: platform dependent
* Default: kqueue (possible values: kqueue, poll)
* Flags: must_restart, wizard
Select the waiter kernel interface.
......@@ -986,6 +1058,7 @@ workspace_backend
~~~~~~~~~~~~~~~~~
* Units: bytes
* Default: 64k
* 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.
......@@ -996,6 +1069,7 @@ workspace_client
~~~~~~~~~~~~~~~~
* Units: bytes
* Default: 64k
* Minimum: 3k
* Flags: delayed
Bytes of HTTP protocol workspace for clients HTTP req/resp. If larger than 4k, use a multiple of 4k for VM efficiency.
......@@ -1005,7 +1079,9 @@ Bytes of HTTP protocol workspace for clients HTTP req/resp. If larger than 4k,
workspace_thread
~~~~~~~~~~~~~~~~
* Units: bytes
* Default: 2048
* Default: 2k
* Minimum: 0.25k
* Maximum: 8k
* Flags: delayed
Bytes of auxillary workspace per thread.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment