diff --git a/doc/configuration.txt b/doc/configuration.txt
index e11b140f3..550144466 100644
--- a/doc/configuration.txt
+++ b/doc/configuration.txt
@@ -1483,6 +1483,7 @@ bind [
]: [, ...] interface
bind []: [, ...] mss
bind []: [, ...] backlog
bind []: [, ...] maxconn
+bind []: [, ...] nice
bind []: [, ...] transparent
bind []: [, ...] id
bind []: [, ...] name
@@ -1572,6 +1573,17 @@ bind / [, ...] [ group | gid ]
assigned if unset. Can only be used when defining only a
single socket.
+ 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.
+
is an optional name provided for stats
is the octal mode used to define access permissions on the
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 925013a35..00531e594 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -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;