From: Willy Tarreau Date: Mon, 29 Jun 2020 13:38:53 +0000 (+0200) Subject: MINOR: stats: add the estimated need of concurrent connections per server X-Git-Tag: v2.2-dev12~55 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a9fcecbdf369e4cba802ce4eac8f298dc861f842;p=thirdparty%2Fhaproxy.git MINOR: stats: add the estimated need of concurrent connections per server The max_used_conns value is used as an estimate of the needed number of connections on a server to know how many to keep open. But this one is not reported, making it hard to troubleshoot reuse issues. Let's export it in the sessions/current column. --- diff --git a/include/haproxy/stats-t.h b/include/haproxy/stats-t.h index c5d68ddebd..01c399d881 100644 --- a/include/haproxy/stats-t.h +++ b/include/haproxy/stats-t.h @@ -426,6 +426,7 @@ enum stat_field { ST_F_IDLE_CONN_CUR, ST_F_SAFE_CONN_CUR, ST_F_USED_CONN_CUR, + ST_F_NEED_CONN_EST, /* must always be the last one */ ST_F_TOTAL_FIELDS diff --git a/src/stats.c b/src/stats.c index 351b79fa00..1a453c3984 100644 --- a/src/stats.c +++ b/src/stats.c @@ -247,6 +247,7 @@ const struct name_desc stat_fields[ST_F_TOTAL_FIELDS] = { [ST_F_IDLE_CONN_CUR] = { .name = "idle_conn_cur", .desc = "Current number of unsafe idle connections"}, [ST_F_SAFE_CONN_CUR] = { .name = "safe_conn_cur", .desc = "Current number of safe idle connections"}, [ST_F_USED_CONN_CUR] = { .name = "used_conn_cur", .desc = "Current number of connections in use"}, + [ST_F_NEED_CONN_EST] = { .name = "need_conn_est", .desc = "Estimated needed number of connections"}, }; /* one line of info */ @@ -997,6 +998,7 @@ static int stats_dump_fields_html(struct buffer *out, "Current idle connections:%s" "- unsafe:%s" "- safe:%s" + "Estimated need of connections:%s" "Active connections limit:%s" "Idle connections limit:%s" "" @@ -1010,6 +1012,7 @@ static int stats_dump_fields_html(struct buffer *out, U2H(stats[ST_F_SRV_ICUR].u.u32), U2H(stats[ST_F_IDLE_CONN_CUR].u.u32), U2H(stats[ST_F_SAFE_CONN_CUR].u.u32), + U2H(stats[ST_F_NEED_CONN_EST].u.u32), LIM2A(stats[ST_F_SLIM].u.u32, "-"), stats[ST_F_SRV_ILIM].type ? U2H(stats[ST_F_SRV_ILIM].u.u32) : "-", @@ -1703,6 +1706,7 @@ int stats_fill_sv_stats(struct proxy *px, struct server *sv, int flags, stats[ST_F_IDLE_CONN_CUR] = mkf_u32(0, sv->curr_idle_nb); stats[ST_F_SAFE_CONN_CUR] = mkf_u32(0, sv->curr_safe_nb); stats[ST_F_USED_CONN_CUR] = mkf_u32(0, sv->curr_used_conns); + stats[ST_F_NEED_CONN_EST] = mkf_u32(0, sv->est_need_conns); /* status */ fld_status = chunk_newstr(out);