diff --git a/doc/configuration.txt b/doc/configuration.txt index 5dc3afab3..d3f049eab 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 a423d7629..ad0b44bf8 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]);