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.
This commit is contained in:
Willy Tarreau 2012-09-06 14:26:36 +02:00
parent 58363cf193
commit 50acaaae5e
2 changed files with 38 additions and 0 deletions

View File

@ -1483,6 +1483,7 @@ bind [<address>]:<port_range> [, ...] interface <interface>
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 @@ bind /<path> [, ...] [ group <user> | gid <gid> ]
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

View File

@ -1875,6 +1875,32 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm)
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;