]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: config: implement global setting tune.buffers.reserve
authorWilly Tarreau <w@1wt.eu>
Tue, 23 Dec 2014 21:40:40 +0000 (22:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 24 Dec 2014 22:47:33 +0000 (23:47 +0100)
Used in conjunction with the dynamic buffer allocator.

tune.buffers.reserve <number>
  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.

doc/configuration.txt
src/cfgparse.c

index 5dc3afab30468d7a715932c8c80f7b9895298879..d3f049eab70f0445301c558024e0f0ff05c471db 100644 (file)
@@ -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 <number>
+  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 <number>
   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
index a423d76294ae76a177727cc30e4d6a2c6e751c5d..ad0b44bf86aa133063553dc3f114a2241480262e 100644 (file)
@@ -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]);