]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: cli/listener: report the number of accepts on "show activity"
authorWilly Tarreau <w@1wt.eu>
Fri, 12 Apr 2019 13:27:17 +0000 (15:27 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 12 Apr 2019 13:54:15 +0000 (15:54 +0200)
The "show activity" command reports the number of incoming connections
dispatched per thread but doesn't report the number of connections
received by each thread. It is important to be able to monitor this
value as it can show that for whatever reason a smaller set of threads
is receiving the connections and dispatching them to all other ones.

include/types/activity.h
src/cli.c
src/listener.c

index 9cf4e731d044625ca4f7cad401eb4a466029b197..329513a39e26d7d04ecd3a76d86b3baf188053f0 100644 (file)
@@ -51,6 +51,7 @@ struct activity {
        struct freq_ctr cpust_1s;  // avg amount of half-ms stolen over last second
        struct freq_ctr_period cpust_15s; // avg amount of half-ms stolen over last 15s
        unsigned int avg_loop_us;  // average run time per loop over last 1024 runs
+       unsigned int accepted;     // accepted incoming connections
        unsigned int accq_pushed;  // accept queue connections pushed
        unsigned int accq_full;    // accept queue connection not pushed because full
        char __pad[0]; // unused except to check remaining room
index 96b59e0f4ea7ef4187d06faf143b8a41a79ec1f6..755a94c133db563a2f09ec2ebd96a8c0c1ab05dc 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -1068,6 +1068,7 @@ static int cli_io_handler_show_activity(struct appctx *appctx)
        chunk_appendf(&trash, "\ncpust_ms_1s:");  for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", read_freq_ctr(&activity[thr].cpust_1s)/2);
        chunk_appendf(&trash, "\ncpust_ms_15s:"); for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", read_freq_ctr_period(&activity[thr].cpust_15s, 15000)/2);
        chunk_appendf(&trash, "\navg_loop_us:");  for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", swrate_avg(activity[thr].avg_loop_us, TIME_STATS_SAMPLES));
+       chunk_appendf(&trash, "\naccepted:");     for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", activity[thr].accepted);
        chunk_appendf(&trash, "\naccq_pushed:");  for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", activity[thr].accq_pushed);
        chunk_appendf(&trash, "\naccq_full:");    for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", activity[thr].accq_full);
 
index 619a3cbdba4e65f3a80dec6434e6eef7733bc07e..d8631883ee730a07dbb62295f1e84c8748f044ad 100644 (file)
@@ -826,6 +826,8 @@ void listener_accept(int fd)
                        HA_ATOMIC_UPDATE_MAX(&global.cps_max, count);
                }
 
+               _HA_ATOMIC_ADD(&activity[tid].accepted, 1);
+
                if (unlikely(cfd >= global.maxsock)) {
                        send_log(p, LOG_EMERG,
                                 "Proxy %s reached the configured maximum connection limit. Please check the global 'maxconn' value.\n",