diff --git a/include/proto/proxy.h b/include/proto/proxy.h index 288ca226a..597c03bb0 100644 --- a/include/proto/proxy.h +++ b/include/proto/proxy.h @@ -68,13 +68,24 @@ static inline void proxy_reset_timeouts(struct proxy *proxy) proxy->timeout.check = TICK_ETERNITY; } -/* increase the number of cumulated connections on the designated frontend */ -static void inline proxy_inc_fe_ctr(struct listener *l, struct proxy *fe) +/* increase the number of cumulated connections received on the designated frontend */ +static void inline proxy_inc_fe_conn_ctr(struct listener *l, struct proxy *fe) { fe->counters.cum_feconn++; if (l->counters) l->counters->cum_conn++; + update_freq_ctr(&fe->fe_conn_per_sec, 1); + if (fe->fe_conn_per_sec.curr_ctr > fe->counters.fe_cps_max) + fe->counters.fe_cps_max = fe->fe_conn_per_sec.curr_ctr; +} + +/* increase the number of cumulated connections accepted by the designated frontend */ +static void inline proxy_inc_fe_sess_ctr(struct listener *l, struct proxy *fe) +{ + fe->counters.cum_fesess++; + if (l->counters) + l->counters->cum_sess++; update_freq_ctr(&fe->fe_sess_per_sec, 1); if (fe->fe_sess_per_sec.curr_ctr > fe->counters.fe_sps_max) fe->counters.fe_sps_max = fe->fe_sess_per_sec.curr_ctr; diff --git a/include/types/counters.h b/include/types/counters.h index 6e620e186..7a0ff1d34 100644 --- a/include/types/counters.h +++ b/include/types/counters.h @@ -26,11 +26,12 @@ struct pxcounters { unsigned int feconn_max, beconn_max; /* max # of active frontend and backend sessions */ long long cum_fe_req; /* cumulated number of processed HTTP requests */ - long long cum_feconn, cum_beconn; /* cumulated number of processed sessions */ - long long cum_lbconn; /* cumulated number of sessions processed by load balancing */ + long long cum_feconn, cum_fesess; /* cumulated number of received/accepted connections */ + long long cum_beconn, cum_lbconn; /* cumulated number of sessions processed by load balancing */ unsigned int fe_rps_max; /* maximum of new sessions per second seen on the frontend */ - unsigned int fe_sps_max; /* maximum of new sessions per second seen on the frontend */ + unsigned int fe_cps_max; /* maximum of new connections per second received on the frontend */ + unsigned int fe_sps_max; /* maximum of new sessions per second accepted on the frontend */ unsigned int be_sps_max; /* maximum of new sessions per second seen on the backend */ unsigned int nbpend_max; /* max number of pending connections with no server assigned yet */ @@ -54,7 +55,8 @@ struct pxcounters { struct licounters { unsigned int conn_max; /* max # of active listener sessions */ - long long cum_conn; /* cumulated number of processed sessions */ + long long cum_conn; /* cumulated number of received connections */ + long long cum_sess; /* cumulated number of accepted sessions */ long long bytes_in; /* number of bytes transferred from the client to the server */ long long bytes_out; /* number of bytes transferred from the server to the client */ diff --git a/include/types/proxy.h b/include/types/proxy.h index f7d4e8c33..aab7b762c 100644 --- a/include/types/proxy.h +++ b/include/types/proxy.h @@ -229,7 +229,8 @@ struct proxy { int totpend; /* total number of pending connections on this instance (for stats) */ unsigned int feconn, beconn; /* # of active frontend and backends sessions */ struct freq_ctr fe_req_per_sec; /* HTTP requests per second on the frontend */ - struct freq_ctr fe_sess_per_sec; /* sessions per second on the frontend */ + struct freq_ctr fe_conn_per_sec; /* received connections per second on the frontend */ + struct freq_ctr fe_sess_per_sec; /* accepted sessions per second on the frontend (after tcp rules) */ struct freq_ctr be_sess_per_sec; /* sessions per second on the backend */ unsigned int maxconn; /* max # of active sessions on the frontend */ unsigned int fe_sps_lim; /* limit on new sessions per second on the frontend */ diff --git a/src/dumpstats.c b/src/dumpstats.c index 4f8429811..1d1e0ff62 100644 --- a/src/dumpstats.c +++ b/src/dumpstats.c @@ -407,6 +407,7 @@ int stats_sock_parse_request(struct stream_interface *si, char *line) px->counters.beconn_max = 0; px->counters.fe_rps_max = 0; px->counters.fe_sps_max = 0; + px->counters.fe_cps_max = 0; px->counters.be_sps_max = 0; px->counters.nbpend_max = 0; } @@ -1514,7 +1515,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) "%s%s" "", (px->mode == PR_MODE_HTTP)?"":"", - U2H6(px->counters.cum_feconn), + U2H6(px->counters.cum_fesess), (px->mode == PR_MODE_HTTP)?"":"", U2H7(px->counters.bytes_in), U2H8(px->counters.bytes_out)); @@ -1559,7 +1560,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri) /* check_status, check_code, check_duration */ ",,,", px->id, - px->feconn, px->counters.feconn_max, px->maxconn, px->counters.cum_feconn, + px->feconn, px->counters.feconn_max, px->maxconn, px->counters.cum_fesess, px->counters.bytes_in, px->counters.bytes_out, px->counters.denied_req, px->counters.denied_resp, px->counters.failed_req, diff --git a/src/session.c b/src/session.c index 0ccd9959d..dcb3fdcdb 100644 --- a/src/session.c +++ b/src/session.c @@ -94,7 +94,7 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) s->logs.accept_date = date; /* user-visible date for logging */ s->logs.tv_accept = now; /* corrected date for internal use */ s->uniq_id = totalconn; - proxy_inc_fe_ctr(l, p); /* note: cum_beconn will be increased once assigned */ + proxy_inc_fe_conn_ctr(l, p); /* note: cum_beconn will be increased once assigned */ t->process = l->handler; t->context = s; @@ -124,6 +124,9 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr) return 0; } + /* This session was accepted, count it now */ + proxy_inc_fe_sess_ctr(l, p); + /* this part should be common with other protocols */ s->si[0].fd = cfd; s->si[0].owner = t;