mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-02 17:41:47 +00:00
[MINOR] switch all stat counters to 64-bit
The byte counters have long been 64-bit to avoid overflows. But with several sites nowadays, we see session counters wrap around every 10-days or so. So it was the moment to switch counters to 64-bit, including error and warning counters which can theorically rise as fast as session counters even if in practice there is very low risk. The performance impact should not be noticeable since those counters are only updated once per session. The stats output have been carefully checked for proper types on both 32- and 64-bit platforms.
This commit is contained in:
parent
ef7341dc3d
commit
3b88d441e9
@ -225,8 +225,8 @@ struct proxy {
|
||||
unsigned int beconn, beconn_max; /* # of active backend sessions */
|
||||
struct freq_ctr fe_sess_per_sec; /* sessions per second on the frontend */
|
||||
struct freq_ctr be_sess_per_sec; /* sessions per second on the backend */
|
||||
unsigned int cum_feconn, cum_beconn; /* cumulated number of processed sessions */
|
||||
unsigned int cum_lbconn; /* cumulated number of sessions processed by load balancing */
|
||||
long long cum_feconn, cum_beconn; /* cumulated number of processed sessions */
|
||||
long long cum_lbconn; /* cumulated number of sessions processed by load balancing */
|
||||
unsigned int maxconn; /* max # of active sessions on the frontend */
|
||||
unsigned int fe_maxsps; /* max # of new sessions per second on the frontend */
|
||||
unsigned int fullconn; /* #conns on backend above which servers are used at full load */
|
||||
@ -238,10 +238,10 @@ struct proxy {
|
||||
unsigned down_time; /* total time the proxy was down */
|
||||
time_t last_change; /* last time, when the state was changed */
|
||||
|
||||
unsigned failed_conns, failed_resp; /* failed connect() and responses */
|
||||
unsigned retries, redispatches; /* retried and redispatched connections */
|
||||
unsigned denied_req, denied_resp; /* blocked requests/responses because of security concerns */
|
||||
unsigned failed_req; /* failed requests (eg: invalid or timeout) */
|
||||
long long failed_conns, failed_resp; /* failed connect() and responses */
|
||||
long long retries, redispatches; /* retried and redispatched connections */
|
||||
long long denied_req, denied_resp; /* blocked requests/responses because of security concerns */
|
||||
long long failed_req; /* failed requests (eg: invalid or timeout) */
|
||||
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 */
|
||||
int conn_retries; /* maximum number of connect retries */
|
||||
|
@ -116,16 +116,16 @@ struct server {
|
||||
struct eb_root *lb_tree; /* we want to know in what tree the server is */
|
||||
struct server *next_full; /* next server in the temporary full list */
|
||||
|
||||
unsigned failed_checks, down_trans; /* failed checks and up-down transitions */
|
||||
long long failed_checks, down_trans; /* failed checks and up-down transitions */
|
||||
unsigned down_time; /* total time the server was down */
|
||||
time_t last_change; /* last time, when the state was changed */
|
||||
|
||||
unsigned failed_conns, failed_resp; /* failed connect() and responses */
|
||||
unsigned retries, redispatches; /* retried and redispatched connections */
|
||||
unsigned failed_secu; /* blocked responses because of security concerns */
|
||||
long long failed_conns, failed_resp; /* failed connect() and responses */
|
||||
long long retries, redispatches; /* retried and redispatched connections */
|
||||
long long failed_secu; /* blocked responses because of security concerns */
|
||||
struct freq_ctr sess_per_sec; /* sessions per second on this server */
|
||||
unsigned cum_sess; /* cumulated number of sessions really sent to this server */
|
||||
unsigned cum_lbconn; /* cumulated number of sessions directed by load balancing */
|
||||
long long cum_sess; /* cumulated number of sessions really sent to this server */
|
||||
long long cum_lbconn; /* cumulated number of sessions directed by load balancing */
|
||||
|
||||
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 */
|
||||
|
@ -728,13 +728,13 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* pxid, name, queue cur, queue max, */
|
||||
"%s,FRONTEND,,,"
|
||||
/* sessions : current, max, limit, total */
|
||||
"%d,%d,%d,%u,"
|
||||
"%d,%d,%d,%lld,"
|
||||
/* bytes : in, out */
|
||||
"%lld,%lld,"
|
||||
/* denied: req, resp */
|
||||
"%d,%d,"
|
||||
"%lld,%lld,"
|
||||
/* errors : request, connect, response */
|
||||
"%d,,,"
|
||||
"%lld,,,"
|
||||
/* warnings: retries, redispatches */
|
||||
",,"
|
||||
/* server status : reflect frontend status */
|
||||
@ -840,7 +840,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* errors : request, connect, response */
|
||||
"<td align=right></td><td align=right>%s</td><td align=right>%s</td>\n"
|
||||
/* warnings: retries, redispatches */
|
||||
"<td align=right>%u</td><td align=right>%u</td>"
|
||||
"<td align=right>%lld</td><td align=right>%lld</td>"
|
||||
"",
|
||||
U2H0(sv->bytes_in), U2H1(sv->bytes_out),
|
||||
U2H2(sv->failed_secu),
|
||||
@ -872,7 +872,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* check failures: unique, fatal, down time */
|
||||
if (sv->state & SRV_CHECKED)
|
||||
chunk_printf(&msg, sizeof(trash),
|
||||
"<td align=right>%d</td><td align=right>%d</td>"
|
||||
"<td align=right>%lld</td><td align=right>%lld</td>"
|
||||
"<td nowrap align=right>%s</td>"
|
||||
"",
|
||||
svs->failed_checks, svs->down_trans,
|
||||
@ -907,15 +907,15 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* queue : current, max */
|
||||
"%d,%d,"
|
||||
/* sessions : current, max, limit, total */
|
||||
"%d,%d,%s,%u,"
|
||||
"%d,%d,%s,%lld,"
|
||||
/* bytes : in, out */
|
||||
"%lld,%lld,"
|
||||
/* denied: req, resp */
|
||||
",%d,"
|
||||
",%lld,"
|
||||
/* errors : request, connect, response */
|
||||
",%d,%d,"
|
||||
",%lld,%lld,"
|
||||
/* warnings: retries, redispatches */
|
||||
"%u,%u,"
|
||||
"%lld,%lld,"
|
||||
"",
|
||||
px->id, sv->id,
|
||||
sv->nbpend, sv->nbpend_max,
|
||||
@ -942,7 +942,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* check failures: unique, fatal; last change, total downtime */
|
||||
if (sv->state & SRV_CHECKED)
|
||||
chunk_printf(&msg, sizeof(trash),
|
||||
"%d,%d,%d,%d,",
|
||||
"%lld,%lld,%d,%d,",
|
||||
sv->failed_checks, sv->down_trans,
|
||||
(int)(now.tv_sec - sv->last_change), srv_downtime(sv));
|
||||
else
|
||||
@ -966,7 +966,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
}
|
||||
|
||||
/* sessions: lbtot */
|
||||
chunk_printf(&msg, sizeof(trash), ",%u,", sv->cum_lbconn);
|
||||
chunk_printf(&msg, sizeof(trash), ",%lld,", sv->cum_lbconn);
|
||||
|
||||
/* tracked */
|
||||
if (sv->tracked)
|
||||
@ -1020,7 +1020,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* errors : request, connect, response */
|
||||
"<td align=right></td><td align=right>%s</td><td align=right>%s</td>\n"
|
||||
/* warnings: retries, redispatches */
|
||||
"<td align=right>%u</td><td align=right>%u</td>"
|
||||
"<td align=right>%lld</td><td align=right>%lld</td>"
|
||||
/* backend status: reflect backend status (up/down): we display UP
|
||||
* if the backend has known working servers or if it has no server at
|
||||
* all (eg: for stats). Then we display the total weight, number of
|
||||
@ -1052,15 +1052,15 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* queue : current, max */
|
||||
"%d,%d,"
|
||||
/* sessions : current, max, limit, total */
|
||||
"%d,%d,%d,%u,"
|
||||
"%d,%d,%d,%lld,"
|
||||
/* bytes : in, out */
|
||||
"%lld,%lld,"
|
||||
/* denied: req, resp */
|
||||
"%d,%d,"
|
||||
"%lld,%lld,"
|
||||
/* errors : request, connect, response */
|
||||
",%d,%d,"
|
||||
",%lld,%lld,"
|
||||
/* warnings: retries, redispatches */
|
||||
"%u,%u,"
|
||||
"%lld,%lld,"
|
||||
/* backend status: reflect backend status (up/down): we display UP
|
||||
* if the backend has known working servers or if it has no server at
|
||||
* all (eg: for stats). Then we display the total weight, number of
|
||||
@ -1070,7 +1070,7 @@ int stats_dump_proxy(struct session *s, struct proxy *px, struct uri_auth *uri)
|
||||
/* rest of backend: nothing, down transitions, last change, total downtime */
|
||||
",%d,%d,%d,,"
|
||||
/* pid, iid, sid, throttle, lbtot, tracked, type */
|
||||
"%d,%d,0,,%u,,%d,"
|
||||
"%d,%d,0,,%lld,,%d,"
|
||||
/* rate */
|
||||
"%u,"
|
||||
"\n",
|
||||
|
@ -279,7 +279,7 @@ void sig_dump_state(int sig)
|
||||
send_log(p, LOG_NOTICE, "SIGHUP received, dumping servers states for proxy %s.\n", p->id);
|
||||
while (s) {
|
||||
snprintf(trash, sizeof(trash),
|
||||
"SIGHUP: Server %s/%s is %s. Conn: %d act, %d pend, %d tot.",
|
||||
"SIGHUP: Server %s/%s is %s. Conn: %d act, %d pend, %lld tot.",
|
||||
p->id, s->id,
|
||||
(s->state & SRV_RUNNING) ? "UP" : "DOWN",
|
||||
s->cur_sess, s->nbpend, s->cum_sess);
|
||||
@ -291,19 +291,19 @@ void sig_dump_state(int sig)
|
||||
/* FIXME: those info are a bit outdated. We should be able to distinguish between FE and BE. */
|
||||
if (!p->srv) {
|
||||
snprintf(trash, sizeof(trash),
|
||||
"SIGHUP: Proxy %s has no servers. Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %d+%d.",
|
||||
"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->cum_feconn, p->cum_beconn);
|
||||
} else if (p->srv_act == 0) {
|
||||
snprintf(trash, sizeof(trash),
|
||||
"SIGHUP: Proxy %s %s ! Conn: act(FE+BE): %d+%d, %d pend (%d unass), tot(FE+BE): %d+%d.",
|
||||
"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->cum_feconn, p->cum_beconn);
|
||||
} else {
|
||||
snprintf(trash, sizeof(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): %d+%d.",
|
||||
" 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->cum_feconn, p->cum_beconn);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user