[MEDIUM] stats: disable complex socket reservation for stats socket

The way the unix socket is initialized is awkward. Some of the settings are put
in the sockets itself, other ones in the backend. And more importantly the
global.maxsock value is adjusted so that the stats socket evades the global
maxconn value. This complexifies maxsock computations for nothing, since the
stats socket is not supposed to receive hundreds of concurrent connections when
the global maxconn is very low. What is needed however is to ensure that there
are always connections left for the stats socket even when traffic sockets are
saturated, but this guarantee is not offered anymore by current code.

So as of now, the stats socket is subject to the global maxconn limitation just
as any other socket until a reservation mechanism is implemented.
This commit is contained in:
Willy Tarreau 2011-09-07 12:13:34 +02:00
parent 46fa8355c0
commit c2adf8b906
2 changed files with 12 additions and 8 deletions

View File

@ -160,6 +160,9 @@ static struct proxy *alloc_stats_fe(const char *name)
fe->last_change = now.tv_sec;
fe->id = strdup("GLOBAL");
fe->cap = PR_CAP_FE;
fe->maxconn = 10; /* default to 10 concurrent connections */
fe->timeout.client = MS_TO_TICKS(10000); /* default timeout of 10 seconds */
return fe;
}
@ -199,7 +202,6 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
snprintf(err, errlen, "out of memory");
return -1;
}
global.stats_fe->timeout.client = MS_TO_TICKS(10000); /* default timeout of 10 seconds */
}
global.stats_sock.state = LI_INIT;
@ -211,7 +213,7 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
global.stats_sock.nice = -64; /* we want to boost priority for local stats */
global.stats_sock.frontend = global.stats_fe;
global.stats_sock.perm.ux.level = ACCESS_LVL_OPER; /* default access level */
global.stats_fe->maxconn = global.stats_sock.maxconn;
global.stats_sock.maxconn = global.stats_fe->maxconn;
global.stats_sock.timeout = &global.stats_fe->timeout.client;
global.stats_sock.next = global.stats_fe->listen;
@ -303,11 +305,14 @@ static int stats_parse_global(char **args, int section_type, struct proxy *curpx
snprintf(err, errlen, "a positive value is expected for 'stats maxconn' in 'global section'");
return -1;
}
global.maxsock -= global.stats_sock.maxconn;
global.stats_sock.maxconn = maxconn;
global.maxsock += global.stats_sock.maxconn;
if (global.stats_fe)
global.stats_fe->maxconn = global.stats_sock.maxconn;
if (!global.stats_fe) {
if ((global.stats_fe = alloc_stats_fe("GLOBAL")) == NULL) {
snprintf(err, errlen, "out of memory");
return -1;
}
}
global.stats_fe->maxconn = maxconn;
}
else {
snprintf(err, errlen, "'stats' only supports 'socket', 'maxconn' and 'timeout' in 'global' section");

View File

@ -106,7 +106,6 @@ struct global global = {
loglev1 : 7, /* max syslog level : debug */
loglev2 : 7,
.stats_sock = {
.maxconn = 10, /* 10 concurrent stats connections */
.perm = {
.ux = {
.uid = -1,