BUG/MINOR: backend: use cum_sess counters instead of cum_conn
This commit is part of a serie to align counters usage between
frontends/listeners on one side and backends/servers on the other.
"stot" metric refers to the total number of sessions. On backend side,
it is interpreted as a number of streams. Previously, this was accounted
using <cum_sess> be_counters field for servers, but <cum_conn> instead
for backend proxies.
Adjust this by using <cum_sess> for both proxies and servers. As such,
<cum_conn> field can be removed from be_counters.
Note that several diagnostic messages which reports total frontend and
backend connections were adjusted to use <cum_sess>. However, this is an
outdated and misleading information as it does reports streams count on
backend side. These messages should be fixed in a separate commit.
This should be backported to all stable releases.
(cherry picked from commit c02ec9a9db205fda124a40a2a87913a0528b0e5b)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit 06053bcad9735562b9eacd6e736e2d71153c665d)
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit 1c8372b1714961f11f943fe2ef6d3e26cf2774ce)
[ad: context adjustement due to missing proxy_inc_fe_cum_sess_ver_ctr()]
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
(cherry picked from commit d33cbf68d14ee28abf9846c14253f2a62e2f4947)
[ad: context adjustment due to queue.length named nbpend]
Signed-off-by: Amaury Denoyelle <adenoyelle@haproxy.com>
diff --git a/include/haproxy/counters-t.h b/include/haproxy/counters-t.h
index 1ea68dd..0d6569b 100644
--- a/include/haproxy/counters-t.h
+++ b/include/haproxy/counters-t.h
@@ -66,7 +66,6 @@
/* counters used by servers and backends */
struct be_counters {
unsigned int conn_max; /* max # of active sessions */
- long long cum_conn; /* cumulated number of received connections */
long long cum_sess; /* cumulated number of accepted connections */
long long cum_lbconn; /* cumulated number of sessions processed by load balancing (BE only) */
unsigned long last_sess; /* last session time */
diff --git a/include/haproxy/proxy.h b/include/haproxy/proxy.h
index 8a2a5c8..8d66d0a 100644
--- a/include/haproxy/proxy.h
+++ b/include/haproxy/proxy.h
@@ -140,10 +140,10 @@
update_freq_ctr(&fe->fe_sess_per_sec, 1));
}
-/* increase the number of cumulated connections on the designated backend */
+/* increase the number of cumulated streams on the designated backend */
static inline void proxy_inc_be_ctr(struct proxy *be)
{
- _HA_ATOMIC_INC(&be->be_counters.cum_conn);
+ _HA_ATOMIC_INC(&be->be_counters.cum_sess);
HA_ATOMIC_UPDATE_MAX(&be->be_counters.sps_max,
update_freq_ctr(&be->be_sess_per_sec, 1));
}
diff --git a/include/haproxy/server.h b/include/haproxy/server.h
index 66dcaf9..126bbee 100644
--- a/include/haproxy/server.h
+++ b/include/haproxy/server.h
@@ -161,7 +161,7 @@
int srv_check_reuse_ws(struct server *srv);
const struct mux_ops *srv_get_ws_proto(struct server *srv);
-/* increase the number of cumulated connections on the designated server */
+/* increase the number of cumulated streams on the designated server */
static inline void srv_inc_sess_ctr(struct server *s)
{
_HA_ATOMIC_INC(&s->counters.cum_sess);
diff --git a/src/haproxy.c b/src/haproxy.c
index 3011d7a..453f80e 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -935,19 +935,19 @@
chunk_printf(&trash,
"SIGHUP: Proxy %s has no servers. Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.",
p->id,
- p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
+ p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_sess);
} else if (p->srv_act == 0) {
chunk_printf(&trash,
"SIGHUP: Proxy %s %s ! Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.",
p->id,
(p->srv_bck) ? "is running on backup servers" : "has no server available",
- p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
+ p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_sess);
} else {
chunk_printf(&trash,
"SIGHUP: Proxy %s has %d active servers and %d backup servers available."
" Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %lld+%lld.",
p->id, p->srv_act, p->srv_bck,
- p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
+ p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_sess);
}
ha_warning("%s\n", trash.area);
send_log(p, LOG_NOTICE, "%s\n", trash.area);
diff --git a/src/proxy.c b/src/proxy.c
index 2ed4ce8..d1a72d7 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -1817,11 +1817,11 @@
*/
if (p->mode == PR_MODE_TCP || p->mode == PR_MODE_HTTP || p->mode == PR_MODE_SYSLOG)
ha_warning("Proxy %s stopped (cumulated conns: FE: %lld, BE: %lld).\n",
- p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
+ p->id, p->fe_counters.cum_conn, p->be_counters.cum_sess);
if (p->mode == PR_MODE_TCP || p->mode == PR_MODE_HTTP)
send_log(p, LOG_WARNING, "Proxy %s stopped (cumulated conns: FE: %lld, BE: %lld).\n",
- p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
+ p->id, p->fe_counters.cum_conn, p->be_counters.cum_sess);
silent:
if (p->table && p->table->size && p->table->sync_task)
diff --git a/src/stats.c b/src/stats.c
index 8b4ae34..60a2cfb 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -2623,7 +2623,7 @@
metric = mkf_u32(FO_CONFIG|FN_LIMIT, px->fullconn);
break;
case ST_F_STOT:
- metric = mkf_u64(FN_COUNTER, px->be_counters.cum_conn);
+ metric = mkf_u64(FN_COUNTER, px->be_counters.cum_sess);
break;
case ST_F_BIN:
metric = mkf_u64(FN_COUNTER, px->be_counters.bytes_in);