From b22fc30aaa6b39a95e190c3914af182a2aa6ecd2 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 14 Dec 2015 12:04:35 +0100 Subject: [PATCH] MINOR: config: make tune.recv_enough configurable This setting used to be assigned to a variable tunable from a constant and for an unknown reason never made its way into the config parser. tune.recv_enough Haproxy uses some hints to detect that a short read indicates the end of the socket buffers. One of them is that a read returns more than bytes, which defaults to 10136 (7 segments of 1448 each). This default value may be changed by this setting to better deal with workloads involving lots of short messages such as telnet or SSH sessions. --- doc/configuration.txt | 8 ++++++++ src/cfgparse.c | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/doc/configuration.txt b/doc/configuration.txt index 2f179fdae..960ab6372 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -593,6 +593,7 @@ The following keywords are supported in the "global" section : - tune.pipesize - tune.rcvbuf.client - tune.rcvbuf.server + - tune.recv_enough - tune.sndbuf.client - tune.sndbuf.server - tune.ssl.cachesize @@ -1280,6 +1281,13 @@ tune.rcvbuf.server order to save kernel memory by preventing it from buffering too large amounts of received data. Lower values will significantly increase CPU usage though. +tune.recv_enough + Haproxy uses some hints to detect that a short read indicates the end of the + socket buffers. One of them is that a read returns more than + bytes, which defaults to 10136 (7 segments of 1448 each). This default value + may be changed by this setting to better deal with workloads involving lots + of short messages such as telnet or SSH sessions. + tune.sndbuf.client tune.sndbuf.server Forces the kernel socket send buffer size on the client or the server side to diff --git a/src/cfgparse.c b/src/cfgparse.c index 97f424309..efbf10dd5 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -707,6 +707,16 @@ int cfg_parse_global(const char *file, int linenum, char **args, int kwm) } global.tune.chksize = atol(args[1]); } + else if (!strcmp(args[0], "tune.recv_enough")) { + if (alertif_too_many_args(1, file, linenum, args, &err_code)) + goto out; + 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.recv_enough = atol(args[1]); + } #ifdef USE_OPENSSL else if (!strcmp(args[0], "tune.ssl.force-private-cache")) { if (alertif_too_many_args(0, file, linenum, args, &err_code))