MINOR: cli/listener: report the number of accepts on "show activity"

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.
This commit is contained in:
Willy Tarreau 2019-04-12 15:27:17 +02:00
parent 0d858446b6
commit 64a9c05f37
3 changed files with 4 additions and 0 deletions

View File

@ -51,6 +51,7 @@ struct activity {
struct freq_ctr cpust_1s; // avg amount of half-ms stolen over last second 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 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 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_pushed; // accept queue connections pushed
unsigned int accq_full; // accept queue connection not pushed because full unsigned int accq_full; // accept queue connection not pushed because full
char __pad[0]; // unused except to check remaining room char __pad[0]; // unused except to check remaining room

View File

@ -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_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, "\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, "\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_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); chunk_appendf(&trash, "\naccq_full:"); for (thr = 0; thr < global.nbthread; thr++) chunk_appendf(&trash, " %u", activity[thr].accq_full);

View File

@ -826,6 +826,8 @@ void listener_accept(int fd)
HA_ATOMIC_UPDATE_MAX(&global.cps_max, count); HA_ATOMIC_UPDATE_MAX(&global.cps_max, count);
} }
_HA_ATOMIC_ADD(&activity[tid].accepted, 1);
if (unlikely(cfd >= global.maxsock)) { if (unlikely(cfd >= global.maxsock)) {
send_log(p, LOG_EMERG, send_log(p, LOG_EMERG,
"Proxy %s reached the configured maximum connection limit. Please check the global 'maxconn' value.\n", "Proxy %s reached the configured maximum connection limit. Please check the global 'maxconn' value.\n",