From: Willy Tarreau Date: Tue, 23 Dec 2014 21:40:40 +0000 (+0100) Subject: MINOR: config: implement global setting tune.buffers.reserve X-Git-Tag: v1.6-dev1~212 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1058ae73f13aac494d24c89a6820c052e99757a1;p=thirdparty%2Fhaproxy.git MINOR: config: implement global setting tune.buffers.reserve Used in conjunction with the dynamic buffer allocator. tune.buffers.reserve Sets the number of buffers which are pre-allocated and reserved for use only during memory shortage conditions resulting in failed memory allocations. The minimum value is 2 and is also the default. There is no reason a user would want to change this value, it's mostly aimed at haproxy core developers. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 5dc3afab30..d3f049eab7 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -891,6 +891,12 @@ spread-checks <0..50, in percent> and +/- 50%. A value between 2 and 5 seems to show good results. The default value remains at 0. +tune.buffers.reserve + Sets the number of buffers which are pre-allocated and reserved for use only + during memory shortage conditions resulting in failed memory allocations. The + minimum value is 2 and is also the default. There is no reason a user would + want to change this value, it's mostly aimed at haproxy core developers. + tune.bufsize Sets the buffer size to this size (in bytes). Lower values allow more sessions to coexist in the same amount of RAM, and higher values allow some diff --git a/src/cfgparse.c b/src/cfgparse.c index a423d76294..ad0b44bf86 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -696,6 +696,16 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } } #endif + else if (!strcmp(args[0], "tune.buffers.reserve")) { + if (*(args[1]) == 0) { + Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } + global.tune.reserved_bufs = atol(args[1]); + if (global.tune.reserved_bufs < 2) + global.tune.reserved_bufs = 2; + } else if (!strcmp(args[0], "tune.bufsize")) { if (*(args[1]) == 0) { Alert("parsing [%s:%d] : '%s' expects an integer argument.\n", file, linenum, args[0]);