MINOR: counters: Add fields to store the max observed for {q,c,d,t}_time

For backends and servers, some average times for last 1024 connections are
already calculated. For the moment, the averages for the time passed in the
queue, the connect time, the response time (for HTTP session only) and the total
time are calculated. Now, in addition, the maximum time observed for these
values are also stored.

In addition, These new counters are cleared as all other max values with the CLI
command "clear counters".

This patch is related to #272.
This commit is contained in:
Christopher Faulet 2019-11-08 14:53:15 +01:00
parent b927a9d866
commit efb41f0d8d
3 changed files with 17 additions and 0 deletions

View File

@ -100,6 +100,7 @@ struct be_counters {
long long down_trans; /* up->down transitions */
unsigned int q_time, c_time, d_time, t_time; /* sums of conn_time, queue_time, data_time, total_time */
unsigned int qtime_max, ctime_max, dtime_max, ttime_max; /* maximum of conn_time, queue_time, data_time, total_time observed */
union {
struct {

View File

@ -3746,6 +3746,10 @@ static int cli_parse_clear_counters(char **args, char *payload, struct appctx *a
px->be_counters.sps_max = 0;
px->be_counters.cps_max = 0;
px->be_counters.nbpend_max = 0;
px->be_counters.qtime_max = 0;
px->be_counters.ctime_max = 0;
px->be_counters.dtime_max = 0;
px->be_counters.ttime_max = 0;
px->fe_counters.conn_max = 0;
px->fe_counters.p.http.rps_max = 0;
@ -3760,6 +3764,10 @@ static int cli_parse_clear_counters(char **args, char *payload, struct appctx *a
sv->counters.cur_sess_max = 0;
sv->counters.nbpend_max = 0;
sv->counters.sps_max = 0;
sv->counters.qtime_max = 0;
sv->counters.ctime_max = 0;
sv->counters.dtime_max = 0;
sv->counters.ttime_max = 0;
}
list_for_each_entry(li, &px->conf.listeners, by_fe)

View File

@ -2956,11 +2956,19 @@ void stream_update_time_stats(struct stream *s)
swrate_add(&srv->counters.c_time, TIME_STATS_SAMPLES, t_connect);
swrate_add(&srv->counters.d_time, TIME_STATS_SAMPLES, t_data);
swrate_add(&srv->counters.t_time, TIME_STATS_SAMPLES, t_close);
HA_ATOMIC_UPDATE_MAX(&srv->counters.qtime_max, t_queue);
HA_ATOMIC_UPDATE_MAX(&srv->counters.ctime_max, t_connect);
HA_ATOMIC_UPDATE_MAX(&srv->counters.dtime_max, t_data);
HA_ATOMIC_UPDATE_MAX(&srv->counters.ttime_max, t_close);
}
swrate_add(&s->be->be_counters.q_time, TIME_STATS_SAMPLES, t_queue);
swrate_add(&s->be->be_counters.c_time, TIME_STATS_SAMPLES, t_connect);
swrate_add(&s->be->be_counters.d_time, TIME_STATS_SAMPLES, t_data);
swrate_add(&s->be->be_counters.t_time, TIME_STATS_SAMPLES, t_close);
HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.qtime_max, t_queue);
HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.ctime_max, t_connect);
HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.dtime_max, t_data);
HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.ttime_max, t_close);
}
/*