MINOR: config: make the tasks "nice" value configurable on "bind" lines.
This is very convenient to reduce SSL processing priority compared to
other traffic. This applies to CPU usage only, but has a direct impact
on latency under congestion.
diff --git a/doc/configuration.txt b/doc/configuration.txt
index e11b140..5501444 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -1483,6 +1483,7 @@
bind [<address>]:<port_range> [, ...] mss <maxseg>
bind [<address>]:<port_range> [, ...] backlog <backlog>
bind [<address>]:<port_range> [, ...] maxconn <maxconn>
+bind [<address>]:<port_range> [, ...] nice <nice>
bind [<address>]:<port_range> [, ...] transparent
bind [<address>]:<port_range> [, ...] id <id>
bind [<address>]:<port_range> [, ...] name <name>
@@ -1572,6 +1573,17 @@
assigned if unset. Can only be used when defining only a
single socket.
+ <nice> sets the 'niceness' of connections initiated from the socket.
+ Value must be in the range -1024..1024, and default is zero.
+ Positive values means that such connections are more friendly
+ to others and easily offer their place in the scheduler. On
+ the opposite, negative values mean that connections want to
+ run with a higher priority. The difference only happens under
+ high loads when the system is close to saturation. Negative
+ values are appropriate for low-latency or admin services, and
+ high values are generally recommended for CPU intensive tasks
+ such as SSL processing which are less sensible to latency.
+
<name> is an optional name provided for stats
<mode> is the octal mode used to define access permissions on the
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 925013a..00531e5 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1875,6 +1875,32 @@
continue;
}
+ if (!strcmp(args[cur_arg], "nice")) {
+ struct listener *l;
+ int val;
+
+ if (!*args[cur_arg + 1]) {
+ Alert("parsing [%s:%d] : '%s' : missing nice value.\n",
+ file, linenum, args[0]);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+
+ val = atol(args[cur_arg + 1]);
+ if (val < -1024 || val > 1024) {
+ Alert("parsing [%s:%d] : '%s' : invalid nice value %d, allowed range is -1024..1024.\n",
+ file, linenum, args[0], val);
+ err_code |= ERR_ALERT | ERR_FATAL;
+ goto out;
+ }
+
+ for (l = curproxy->listen; l != last_listen; l = l->next)
+ l->nice = val;
+
+ cur_arg += 2;
+ continue;
+ }
+
if (!strcmp(args[cur_arg], "ssl")) { /* use ssl certificate */
#ifdef USE_OPENSSL
struct listener *l;