mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
MINOR: cli: ability to set per-server maxconn
This commit adds support for setting a per-server maxconn from the stats socket. The only really notable part of this commit is that we need to check if maxconn == minconn before changing things, as this indicates that we are NOT using dynamic maxconn. When we are not using dynamic maxconn, we should update maxconn/minconn in lockstep.
This commit is contained in:
parent
d1b0f7c3e0
commit
edb93a7c28
@ -1356,6 +1356,11 @@ set maxconn frontend <frontend> <value>
|
|||||||
delayed until the threshold is reached. The frontend might be specified by
|
delayed until the threshold is reached. The frontend might be specified by
|
||||||
either its name or its numeric ID prefixed with a sharp ('#').
|
either its name or its numeric ID prefixed with a sharp ('#').
|
||||||
|
|
||||||
|
set maxconn server <backend/server> <value>
|
||||||
|
Dynamically change the specified server's maxconn setting. Any positive
|
||||||
|
value is allowed including zero, but setting values larger than the global
|
||||||
|
maxconn does not make much sense.
|
||||||
|
|
||||||
set maxconn global <maxconn>
|
set maxconn global <maxconn>
|
||||||
Dynamically change the global maxconn setting within the range defined by the
|
Dynamically change the global maxconn setting within the range defined by the
|
||||||
initial global maxconn setting. If it is increased and connections were
|
initial global maxconn setting. If it is increased and connections were
|
||||||
|
@ -1646,6 +1646,38 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
else if (strcmp(args[2], "server") == 0) {
|
||||||
|
struct server *sv;
|
||||||
|
int v;
|
||||||
|
|
||||||
|
sv = expect_server_admin(s, si, args[3]);
|
||||||
|
if (!sv)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
if (!*args[4]) {
|
||||||
|
appctx->ctx.cli.msg = "Integer value expected.\n";
|
||||||
|
appctx->st0 = STAT_CLI_PRINT;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
v = atoi(args[4]);
|
||||||
|
if (v < 0) {
|
||||||
|
appctx->ctx.cli.msg = "Value out of range.\n";
|
||||||
|
appctx->st0 = STAT_CLI_PRINT;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sv->maxconn == sv->minconn) { // static maxconn
|
||||||
|
sv->maxconn = sv->minconn = v;
|
||||||
|
} else { // dynamic maxconn
|
||||||
|
sv->maxconn = v;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (may_dequeue_tasks(sv, sv->proxy))
|
||||||
|
process_srv_queue(sv);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
else if (strcmp(args[2], "global") == 0) {
|
else if (strcmp(args[2], "global") == 0) {
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
@ -1681,7 +1713,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
appctx->ctx.cli.msg = "'set maxconn' only supports 'frontend' and 'global'.\n";
|
appctx->ctx.cli.msg = "'set maxconn' only supports 'frontend', 'server', and 'global'.\n";
|
||||||
appctx->st0 = STAT_CLI_PRINT;
|
appctx->st0 = STAT_CLI_PRINT;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user