]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[MEDIUM] stats: split frontend and backend stats
authorWilly Tarreau <w@1wt.eu>
Thu, 10 Mar 2011 22:25:56 +0000 (23:25 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 13 Mar 2011 21:00:23 +0000 (22:00 +0100)
It's very annoying that frontend and backend stats are merged because we
don't know what we're observing. For instance, if a "listen" instance
makes use of a distinct backend, it's impossible to know what the bytes_out
means.

Some points take care of not updating counters twice if the backend points
to the frontend, indicating a "listen" instance. The thing becomes more
complex when we try to add support for server side keep-alive, because we
have to maintain a pointer to the backend used for last request, and to
update its stats. But we can't perform such comparisons anymore because
the counters will not match anymore.

So in order to get rid of this situation, let's have both frontend AND
backend stats in the "struct proxy". We simply update the relevant ones
during activity. Some of them are only accounted for in the backend,
while others are just for frontend. Maybe we can improve a bit on that
later, but the essential part is that those counters now reflect what
they really mean.

12 files changed:
include/proto/proxy.h
include/types/counters.h
include/types/proxy.h
src/backend.c
src/dumpstats.c
src/frontend.c
src/haproxy.c
src/proto_http.c
src/proto_tcp.c
src/proxy.c
src/queue.c
src/session.c

index 597c03bb011294190ca969bf5df30b95544fe99c..ed29f145941218352cb48bc8f259b9611d0cef94 100644 (file)
@@ -71,42 +71,42 @@ static inline void proxy_reset_timeouts(struct proxy *proxy)
 /* 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++;
+       fe->fe_counters.cum_conn++;
        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;
+       if (fe->fe_conn_per_sec.curr_ctr > fe->fe_counters.cps_max)
+               fe->fe_counters.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++;
+       fe->fe_counters.cum_sess++;
        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;
+       if (fe->fe_sess_per_sec.curr_ctr > fe->fe_counters.sps_max)
+               fe->fe_counters.sps_max = fe->fe_sess_per_sec.curr_ctr;
 }
 
 /* increase the number of cumulated connections on the designated backend */
 static void inline proxy_inc_be_ctr(struct proxy *be)
 {
-       be->counters.cum_beconn++;
+       be->be_counters.cum_conn++;
        update_freq_ctr(&be->be_sess_per_sec, 1);
-       if (be->be_sess_per_sec.curr_ctr > be->counters.be_sps_max)
-               be->counters.be_sps_max = be->be_sess_per_sec.curr_ctr;
+       if (be->be_sess_per_sec.curr_ctr > be->be_counters.sps_max)
+               be->be_counters.sps_max = be->be_sess_per_sec.curr_ctr;
 }
 
 /* increase the number of cumulated requests on the designated frontend */
 static void inline proxy_inc_fe_req_ctr(struct proxy *fe)
 {
-       fe->counters.cum_fe_req++;
+       fe->fe_counters.p.http.cum_req++;
        update_freq_ctr(&fe->fe_req_per_sec, 1);
-       if (fe->fe_req_per_sec.curr_ctr > fe->counters.fe_rps_max)
-               fe->counters.fe_rps_max = fe->fe_req_per_sec.curr_ctr;
+       if (fe->fe_req_per_sec.curr_ctr > fe->fe_counters.p.http.rps_max)
+               fe->fe_counters.p.http.rps_max = fe->fe_req_per_sec.curr_ctr;
 }
 
 #endif /* _PROTO_PROXY_H */
index a333219cb569cf5afecc0e978c62aa4daee48aa3..e3e051ff1d0117ff2834f0eb047fd1084883f233 100644 (file)
@@ -1,56 +1,61 @@
 /*
-  include/types/counters.h
-  This file contains structure declarations for statistics counters.
-
-  Copyright 2008-2009 Krzysztof Piotr Oledzki <ole@ans.pl>
-
-  This library is free software; you can redistribute it and/or
-  modify it under the terms of the GNU Lesser General Public
-  License as published by the Free Software Foundation, version 2.1
-  exclusively.
-
-  This library is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-  Lesser General Public License for more details.
-
-  You should have received a copy of the GNU Lesser General Public
-  License along with this library; if not, write to the Free Software
-  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-*/
+ * include/types/counters.h
+ * This file contains structure declarations for statistics counters.
+ *
+ * Copyright 2008-2009 Krzysztof Piotr Oledzki <ole@ans.pl>
+ * Copyright 2011 Willy Tarreau <w@1wt.eu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
 
 #ifndef _TYPES_COUNTERS_H
 #define _TYPES_COUNTERS_H
 
+/* maybe later we might thing about having a different struct for FE and BE */
 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_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_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 */
-
-       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 */
-
-       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 denied_conn;                  /* denied connection requests (tcp-req rules) */
+       unsigned int conn_max;                  /* max # of active sessions */
+       long long    cum_conn;                  /* cumulated number of received connections */
+       long long    cum_sess;                  /* cumulated number of accepted connections */
+       long long  cum_lbconn;                  /* cumulated number of sessions processed by load balancing (BE only) */
+
+       unsigned int cps_max;                   /* maximum of new connections received per second */
+       unsigned int sps_max;                   /* maximum of new connections accepted per second (sessions) */
+       unsigned int nbpend_max;                /* max number of pending connections with no server assigned yet (BE only) */
+
+       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 */
+
+       long long denied_req;                   /* blocked requests/responses because of security concerns */
+       long long denied_resp;                  /* blocked requests/responses because of security concerns */
+       long long failed_req;                   /* failed requests (eg: invalid or timeout) */
+       long long denied_conn;                  /* denied connection requests (tcp-req rules) */
+
+       long long failed_conns;                 /* failed connect() attempts (BE only) */
+       long long failed_resp;                  /* failed responses (BE only) */
+       long long cli_aborts;                   /* aborted responses during DATA phase caused by the client */
+       long long srv_aborts;                   /* aborted responses during DATA phase caused by the server */
+       long long retries;                      /* retried and redispatched connections (BE only) */
+       long long redispatches;                 /* retried and redispatched connections (BE only) */
 
        union {
                struct {
-                       long long rsp[6];       /* http response codes */
+                       long long cum_req;      /* cumulated number of processed HTTP requests */
+                       unsigned int rps_max;   /* maximum of new HTTP requests second observed */
+                       long long rsp[6];       /* http response codes */
                } http;
-       } fe, be;                               /* FE and BE stats */
-
-       long long failed_conns, failed_resp;    /* failed connect() and responses */
-       long long cli_aborts, srv_aborts;       /* aborted responses during DATA phase due to client or server */
-       long long retries, redispatches;        /* retried and redispatched connections */
+       } p;                                    /* protocol-specific stats */
 };
 
 struct licounters {
index 95736b183054dd0d592a30301217c7c83a3fa52c..6208d7ba416924ce289ebd76f99624ecfb55db22 100644 (file)
@@ -297,7 +297,8 @@ struct proxy {
                         *rsp_cap_pool;
        struct pool_head *hdr_idx_pool;         /* pools of pre-allocated int* used for headers indexing */
        struct list req_add, rsp_add;           /* headers to be added */
-       struct pxcounters counters;             /* statistics counters */
+       struct pxcounters be_counters;          /* backend statistics counters */
+       struct pxcounters fe_counters;          /* frontend statistics counters */
 
        struct stktable table;                  /* table for storing sticking sessions */
 
index e2ad5b2b4c8c58adf64cfe1246714c88023df7af..93a8fc83170e9db22fab874ae186dc4107a73ea4 100644 (file)
@@ -613,7 +613,7 @@ int assign_server(struct session *s)
                        goto out;
                }
                else if (srv != prev_srv) {
-                       s->be->counters.cum_lbconn++;
+                       s->be->be_counters.cum_lbconn++;
                        srv->counters.cum_lbconn++;
                }
                set_target_server(&s->target, srv);
@@ -800,10 +800,10 @@ int assign_server_and_queue(struct session *s)
                                }
                                s->flags |= SN_REDISP;
                                prev_srv->counters.redispatches++;
-                               s->be->counters.redispatches++;
+                               s->be->be_counters.redispatches++;
                        } else {
                                prev_srv->counters.retries++;
-                               s->be->counters.retries++;
+                               s->be->be_counters.retries++;
                        }
                }
        }
@@ -1036,7 +1036,7 @@ int srv_redispatch_connect(struct session *t)
                }
 
                srv->counters.failed_conns++;
-               t->be->counters.failed_conns++;
+               t->be->be_counters.failed_conns++;
                return 1;
 
        case SRV_STATUS_NOSRV:
@@ -1046,7 +1046,7 @@ int srv_redispatch_connect(struct session *t)
                        t->req->cons->err_loc = NULL;
                }
 
-               t->be->counters.failed_conns++;
+               t->be->be_counters.failed_conns++;
                return 1;
 
        case SRV_STATUS_QUEUED:
@@ -1066,7 +1066,7 @@ int srv_redispatch_connect(struct session *t)
                        srv_inc_sess_ctr(srv);
                if (srv)
                        srv->counters.failed_conns++;
-               t->be->counters.failed_conns++;
+               t->be->be_counters.failed_conns++;
 
                /* release other sessions waiting for this server */
                if (may_dequeue_tasks(srv, t->be))
index b04b297fadd2a22ea9c49adadc44b24f281ad7c5..34f09014fee6eb77d34fab17c2a15afb415f6df2 100644 (file)
@@ -493,16 +493,22 @@ int stats_sock_parse_request(struct stream_interface *si, char *line)
                        }
 
                        for (px = proxy; px; px = px->next) {
-                               if (clrall)
-                                       memset(&px->counters, 0, sizeof(px->counters));
+                               if (clrall) {
+                                       memset(&px->be_counters, 0, sizeof(px->be_counters));
+                                       memset(&px->fe_counters, 0, sizeof(px->fe_counters));
+                               }
                                else {
-                                       px->counters.feconn_max = 0;
-                                       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;
+                                       px->be_counters.conn_max = 0;
+                                       px->be_counters.p.http.rps_max = 0;
+                                       px->be_counters.sps_max = 0;
+                                       px->be_counters.cps_max = 0;
+                                       px->be_counters.nbpend_max = 0;
+
+                                       px->fe_counters.conn_max = 0;
+                                       px->fe_counters.p.http.rps_max = 0;
+                                       px->fe_counters.sps_max = 0;
+                                       px->fe_counters.cps_max = 0;
+                                       px->fe_counters.nbpend_max = 0;
                                }
 
                                for (sv = px->srv; sv; sv = sv->next)
@@ -1761,8 +1767,8 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                                     "",
                                                     read_freq_ctr(&px->fe_req_per_sec),
                                                     U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
-                                                    px->counters.fe_rps_max,
-                                                    U2H1(px->counters.fe_sps_max),
+                                                    px->fe_counters.p.http.rps_max,
+                                                    U2H1(px->fe_counters.sps_max),
                                                     LIM2A2(px->fe_sps_lim, "-"));
                                } else {
                                        chunk_printf(&msg,
@@ -1770,7 +1776,7 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                                     "<td>%s</td><td>%s</td><td>%s</td>"
                                                     "",
                                                     U2H0(read_freq_ctr(&px->fe_sess_per_sec)),
-                                                    U2H1(px->counters.fe_sps_max), LIM2A2(px->fe_sps_lim, "-"));
+                                                    U2H1(px->fe_counters.sps_max), LIM2A2(px->fe_sps_lim, "-"));
                                }
 
                                chunk_printf(&msg,
@@ -1778,18 +1784,18 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     "<td>%s</td><td>%s</td><td>%s</td>"
                                     "<td"
                                     "",
-                                    U2H3(px->feconn), U2H4(px->counters.feconn_max), U2H5(px->maxconn));
+                                    U2H3(px->feconn), U2H4(px->fe_counters.conn_max), U2H5(px->maxconn));
 
                                /* http response (via td title): 1xx, 2xx, 3xx, 4xx, 5xx, other */
                                if (px->mode == PR_MODE_HTTP) {
                                        int i;
 
-                                       chunk_printf(&msg, " title=\"%lld requests:", px->counters.cum_fe_req);
+                                       chunk_printf(&msg, " title=\"%lld requests:", px->fe_counters.p.http.cum_req);
 
                                        for (i = 1; i < 6; i++)
-                                               chunk_printf(&msg, " %dxx=%lld,", i, px->counters.fe.http.rsp[i]);
+                                               chunk_printf(&msg, " %dxx=%lld,", i, px->fe_counters.p.http.rsp[i]);
 
-                                       chunk_printf(&msg, " other=%lld\"", px->counters.fe.http.rsp[0]);
+                                       chunk_printf(&msg, " other=%lld\"", px->fe_counters.p.http.rsp[0]);
                                }
 
                                chunk_printf(&msg,
@@ -1799,9 +1805,9 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     "<td>%s</td><td>%s</td>"
                                     "",
                                     (px->mode == PR_MODE_HTTP)?"<u>":"",
-                                    U2H6(px->counters.cum_fesess),
+                                    U2H6(px->fe_counters.cum_sess),
                                     (px->mode == PR_MODE_HTTP)?"</u>":"",
-                                    U2H7(px->counters.bytes_in), U2H8(px->counters.bytes_out));
+                                    U2H7(px->fe_counters.bytes_in), U2H8(px->fe_counters.bytes_out));
 
                                chunk_printf(&msg,
                                     /* denied: req, resp */
@@ -1815,8 +1821,8 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     /* rest of server: nothing */
                                     "<td class=ac colspan=8></td></tr>"
                                     "",
-                                    U2H0(px->counters.denied_req), U2H1(px->counters.denied_resp),
-                                    U2H2(px->counters.failed_req),
+                                    U2H0(px->fe_counters.denied_req), U2H1(px->fe_counters.denied_resp),
+                                    U2H2(px->fe_counters.failed_req),
                                     px->state == PR_STRUN ? "OPEN" :
                                     px->state == PR_STIDLE ? "FULL" : "STOP");
                        } else {
@@ -1844,24 +1850,24 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     /* check_status, check_code, check_duration */
                                     ",,,",
                                     px->id,
-                                    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,
+                                    px->feconn, px->fe_counters.conn_max, px->maxconn, px->fe_counters.cum_sess,
+                                    px->fe_counters.bytes_in, px->fe_counters.bytes_out,
+                                    px->fe_counters.denied_req, px->fe_counters.denied_resp,
+                                    px->fe_counters.failed_req,
                                     px->state == PR_STRUN ? "OPEN" :
                                     px->state == PR_STIDLE ? "FULL" : "STOP",
                                     relative_pid, px->uuid, STATS_TYPE_FE,
                                     read_freq_ctr(&px->fe_sess_per_sec),
-                                    px->fe_sps_lim, px->counters.fe_sps_max);
+                                    px->fe_sps_lim, px->fe_counters.sps_max);
 
                                /* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */
                                if (px->mode == PR_MODE_HTTP) {
                                        int i;
 
                                        for (i=1; i<6; i++)
-                                               chunk_printf(&msg, "%lld,", px->counters.fe.http.rsp[i]);
+                                               chunk_printf(&msg, "%lld,", px->fe_counters.p.http.rsp[i]);
 
-                                       chunk_printf(&msg, "%lld,", px->counters.fe.http.rsp[0]);
+                                       chunk_printf(&msg, "%lld,", px->fe_counters.p.http.rsp[0]);
                                } else {
                                        chunk_printf(&msg, ",,,,,,");
                                }
@@ -1872,7 +1878,7 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                /* requests : req_rate, req_rate_max, req_tot, */
                                chunk_printf(&msg, "%u,%u,%lld,",
                                             read_freq_ctr(&px->fe_req_per_sec),
-                                            px->counters.fe_rps_max, px->counters.cum_fe_req);
+                                            px->fe_counters.p.http.rps_max, px->fe_counters.p.http.cum_req);
 
                                /* errors: cli_aborts, srv_aborts */
                                chunk_printf(&msg, ",,");
@@ -2485,15 +2491,15 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     (uri->flags & ST_SHLGNDS)?"<u>":"",
                                     px->id, px->id,
                                     (uri->flags & ST_SHLGNDS)?"</u>":"",
-                                    U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->counters.nbpend_max),
-                                    U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->counters.be_sps_max));
+                                    U2H0(px->nbpend) /* or px->totpend ? */, U2H1(px->be_counters.nbpend_max),
+                                    U2H2(read_freq_ctr(&px->be_sess_per_sec)), U2H3(px->be_counters.sps_max));
 
                                chunk_printf(&msg,
                                     /* sessions: current, max, limit */
                                     "<td>%s</td><td>%s</td><td>%s</td>"
                                     "<td"
                                     "",
-                                    U2H2(px->beconn), U2H3(px->counters.beconn_max), U2H4(px->fullconn));
+                                    U2H2(px->beconn), U2H3(px->be_counters.conn_max), U2H4(px->fullconn));
 
                                /* http response (via td title): 1xx, 2xx, 3xx, 4xx, 5xx, other */
                                if (px->mode == PR_MODE_HTTP) {
@@ -2502,9 +2508,9 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                        chunk_printf(&msg, " title=\"rsp codes:");
 
                                        for (i = 1; i < 6; i++)
-                                               chunk_printf(&msg, " %dxx=%lld", i, px->counters.be.http.rsp[i]);
+                                               chunk_printf(&msg, " %dxx=%lld", i, px->be_counters.p.http.rsp[i]);
 
-                                       chunk_printf(&msg, " other=%lld\"", px->counters.be.http.rsp[0]);
+                                       chunk_printf(&msg, " other=%lld\"", px->be_counters.p.http.rsp[0]);
                                }
 
                                chunk_printf(&msg,
@@ -2514,10 +2520,10 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     "<td>%s</td><td>%s</td>"
                                     "",
                                     (px->mode == PR_MODE_HTTP)?"<u>":"",
-                                    U2H6(px->counters.cum_beconn),
+                                    U2H6(px->be_counters.cum_conn),
                                     (px->mode == PR_MODE_HTTP)?"</u>":"",
-                                    U2H7(px->counters.cum_lbconn),
-                                    U2H8(px->counters.bytes_in), U2H9(px->counters.bytes_out));
+                                    U2H7(px->be_counters.cum_lbconn),
+                                    U2H8(px->be_counters.bytes_in), U2H9(px->be_counters.bytes_out));
 
                                chunk_printf(&msg,
                                     /* denied: req, resp */
@@ -2535,12 +2541,12 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     "<td class=ac>%s %s</td><td class=ac>&nbsp;</td><td class=ac>%d</td>"
                                     "<td class=ac>%d</td><td class=ac>%d</td>"
                                     "",
-                                    U2H0(px->counters.denied_req), U2H1(px->counters.denied_resp),
-                                    U2H2(px->counters.failed_conns),
-                                    px->counters.cli_aborts,
-                                    px->counters.srv_aborts,
-                                    U2H5(px->counters.failed_resp),
-                                    px->counters.retries, px->counters.redispatches,
+                                    U2H0(px->be_counters.denied_req), U2H1(px->be_counters.denied_resp),
+                                    U2H2(px->be_counters.failed_conns),
+                                    px->be_counters.cli_aborts,
+                                    px->be_counters.srv_aborts,
+                                    U2H5(px->be_counters.failed_resp),
+                                    px->be_counters.retries, px->be_counters.redispatches,
                                     human_time(now.tv_sec - px->last_change, 1),
                                     (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" :
                                             "<font color=\"red\"><b>DOWN</b></font>",
@@ -2586,30 +2592,30 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
                                     /* check_status, check_code, check_duration */
                                     ",,,",
                                     px->id,
-                                    px->nbpend /* or px->totpend ? */, px->counters.nbpend_max,
-                                    px->beconn, px->counters.beconn_max, px->fullconn, px->counters.cum_beconn,
-                                    px->counters.bytes_in, px->counters.bytes_out,
-                                    px->counters.denied_req, px->counters.denied_resp,
-                                    px->counters.failed_conns, px->counters.failed_resp,
-                                    px->counters.retries, px->counters.redispatches,
+                                    px->nbpend /* or px->totpend ? */, px->be_counters.nbpend_max,
+                                    px->beconn, px->be_counters.conn_max, px->fullconn, px->be_counters.cum_conn,
+                                    px->be_counters.bytes_in, px->be_counters.bytes_out,
+                                    px->be_counters.denied_req, px->be_counters.denied_resp,
+                                    px->be_counters.failed_conns, px->be_counters.failed_resp,
+                                    px->be_counters.retries, px->be_counters.redispatches,
                                     (px->lbprm.tot_weight > 0 || !px->srv) ? "UP" : "DOWN",
                                     (px->lbprm.tot_weight * px->lbprm.wmult + px->lbprm.wdiv - 1) / px->lbprm.wdiv,
                                     px->srv_act, px->srv_bck,
                                     px->down_trans, (int)(now.tv_sec - px->last_change),
                                     px->srv?be_downtime(px):0,
                                     relative_pid, px->uuid,
-                                    px->counters.cum_lbconn, STATS_TYPE_BE,
+                                    px->be_counters.cum_lbconn, STATS_TYPE_BE,
                                     read_freq_ctr(&px->be_sess_per_sec),
-                                    px->counters.be_sps_max);
+                                    px->be_counters.sps_max);
 
                                /* http response: 1xx, 2xx, 3xx, 4xx, 5xx, other */
                                if (px->mode == PR_MODE_HTTP) {
                                        int i;
 
                                        for (i=1; i<6; i++)
-                                               chunk_printf(&msg, "%lld,", px->counters.be.http.rsp[i]);
+                                               chunk_printf(&msg, "%lld,", px->be_counters.p.http.rsp[i]);
 
-                                       chunk_printf(&msg, "%lld,", px->counters.be.http.rsp[0]);
+                                       chunk_printf(&msg, "%lld,", px->be_counters.p.http.rsp[0]);
                                } else {
                                        chunk_printf(&msg, ",,,,,,");
                                }
@@ -2622,7 +2628,7 @@ int stats_dump_proxy(struct stream_interface *si, struct proxy *px, struct uri_a
 
                                /* errors: cli_aborts, srv_aborts */
                                chunk_printf(&msg, "%lld,%lld,",
-                                            px->counters.cli_aborts, px->counters.srv_aborts);
+                                            px->be_counters.cli_aborts, px->be_counters.srv_aborts);
 
                                /* finish with EOL */
                                chunk_printf(&msg, "\n");
index 9c6ff0bb23c3bfc433dcdea687cc95b55f830aab..75218df53967a4eaa8f6d6b709d6fb6c16fd6ba9 100644 (file)
@@ -449,7 +449,7 @@ int frontend_decode_proxy_request(struct session *s, struct buffer *req, int an_
        buffer_abort(s->rep);
        req->analysers = 0;
 
-       s->fe->counters.failed_req++;
+       s->fe->fe_counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
 
index d1f71950c6b326119ec54f8dc5f0c0932bbea44d..064c49c47f31f428ff2d923b9924da5214144354 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * HA-Proxy : High Availability-enabled HTTP/TCP proxy
- * Copyright 2000-2010  Willy Tarreau <w@1wt.eu>.
+ * Copyright 2000-2011  Willy Tarreau <w@1wt.eu>.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -310,19 +310,19 @@ void sig_dump_state(struct sig_handler *sh)
                        snprintf(trash, sizeof(trash),
                                 "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->counters.cum_feconn, p->counters.cum_beconn);
+                                p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
                } 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): %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->counters.cum_feconn, p->counters.cum_beconn);
+                                p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
                } 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): %lld+%lld.",
                                 p->id, p->srv_act, p->srv_bck,
-                                p->feconn, p->beconn, p->totpend, p->nbpend, p->counters.cum_feconn, p->counters.cum_beconn);
+                                p->feconn, p->beconn, p->totpend, p->nbpend, p->fe_counters.cum_conn, p->be_counters.cum_conn);
                }
                Warning("%s\n", trash);
                send_log(p, LOG_NOTICE, "%s\n", trash);
index ff2f44cac34f9cd088f6315fdff6515f8f2935b3..c72cddf28fb2b2ecfa33b7744ec0c32a20bee70b 100644 (file)
@@ -2530,7 +2530,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
 
                        session_inc_http_req_ctr(s);
                        proxy_inc_fe_req_ctr(s->fe);
-                       s->fe->counters.failed_req++;
+                       s->fe->fe_counters.failed_req++;
                        if (s->listener->counters)
                                s->listener->counters->failed_req++;
 
@@ -2559,7 +2559,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
 
                        session_inc_http_req_ctr(s);
                        proxy_inc_fe_req_ctr(s->fe);
-                       s->fe->counters.failed_req++;
+                       s->fe->fe_counters.failed_req++;
                        if (s->listener->counters)
                                s->listener->counters->failed_req++;
 
@@ -2586,7 +2586,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
                        session_inc_http_err_ctr(s);
                        session_inc_http_req_ctr(s);
                        proxy_inc_fe_req_ctr(s->fe);
-                       s->fe->counters.failed_req++;
+                       s->fe->fe_counters.failed_req++;
                        if (s->listener->counters)
                                s->listener->counters->failed_req++;
 
@@ -2862,7 +2862,7 @@ int http_wait_for_request(struct session *s, struct buffer *req, int an_bit)
        txn->status = 400;
        stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
 
-       s->fe->counters.failed_req++;
+       s->fe->fe_counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
 
@@ -3433,7 +3433,7 @@ int http_process_req_common(struct session *s, struct buffer *req, int an_bit, s
        txn->status = 400;
        stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
 
-       s->fe->counters.failed_req++;
+       s->fe->fe_counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
 
@@ -3683,7 +3683,7 @@ int http_process_request(struct session *s, struct buffer *req, int an_bit)
        req->analysers = 0;
        stream_int_retnclose(req->prod, error_message(s, HTTP_ERR_400));
 
-       s->fe->counters.failed_req++;
+       s->fe->fe_counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
 
@@ -3727,7 +3727,7 @@ int http_process_tarpit(struct session *s, struct buffer *req, int an_bit)
        req->analysers = 0;
        req->analyse_exp = TICK_ETERNITY;
 
-       s->fe->counters.failed_req++;
+       s->fe->fe_counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
 
@@ -3867,7 +3867,7 @@ int http_process_request_body(struct session *s, struct buffer *req, int an_bit)
 
  return_err_msg:
        req->analysers = 0;
-       s->fe->counters.failed_req++;
+       s->fe->fe_counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
        return 0;
@@ -3906,11 +3906,11 @@ void http_end_txn_clean_session(struct session *s)
                        n = 0;
 
                if (s->fe->mode == PR_MODE_HTTP)
-                       s->fe->counters.fe.http.rsp[n]++;
+                       s->fe->fe_counters.p.http.rsp[n]++;
 
                if ((s->flags & SN_BE_ASSIGNED) &&
                    (s->be->mode == PR_MODE_HTTP))
-                       s->be->counters.be.http.rsp[n]++;
+                       s->be->be_counters.p.http.rsp[n]++;
        }
 
        /* don't count other requests' data */
@@ -4232,7 +4232,7 @@ int http_sync_res_state(struct session *s)
                }
                else if (buf->flags & BF_SHUTW) {
                        txn->rsp.msg_state = HTTP_MSG_ERROR;
-                       s->be->counters.cli_aborts++;
+                       s->be->be_counters.cli_aborts++;
                        if (target_srv(&s->target))
                                target_srv(&s->target)->counters.cli_aborts++;
                        goto wait_other_side;
@@ -4513,9 +4513,8 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
                                s->flags |= SN_FINST_D;
                }
 
-               s->fe->counters.cli_aborts++;
-               if (s->fe != s->be)
-                       s->be->counters.cli_aborts++;
+               s->fe->fe_counters.cli_aborts++;
+               s->be->be_counters.cli_aborts++;
                if (target_srv(&s->target))
                        target_srv(&s->target)->counters.cli_aborts++;
 
@@ -4536,7 +4535,7 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
        return 0;
 
  return_bad_req: /* let's centralize all bad requests */
-       s->fe->counters.failed_req++;
+       s->fe->fe_counters.failed_req++;
        if (s->listener->counters)
                s->listener->counters->failed_req++;
  return_bad_req_stats_ok:
@@ -4573,9 +4572,8 @@ int http_request_forward_body(struct session *s, struct buffer *req, int an_bit)
        req->analysers = 0;
        s->rep->analysers = 0; /* we're in data phase, we want to abort both directions */
 
-       s->fe->counters.srv_aborts++;
-       if (s->fe != s->be)
-               s->be->counters.srv_aborts++;
+       s->fe->fe_counters.srv_aborts++;
+       s->be->be_counters.srv_aborts++;
        if (target_srv(&s->target))
                target_srv(&s->target)->counters.srv_aborts++;
 
@@ -4702,7 +4700,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
                        if (msg->msg_state == HTTP_MSG_ERROR || msg->err_pos >= 0)
                                http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
 
-                       s->be->counters.failed_resp++;
+                       s->be->be_counters.failed_resp++;
                        if (target_srv(&s->target)) {
                                target_srv(&s->target)->counters.failed_resp++;
                                health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_HDRRSP);
@@ -4733,7 +4731,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
                        if (msg->err_pos >= 0)
                                http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
 
-                       s->be->counters.failed_resp++;
+                       s->be->be_counters.failed_resp++;
                        if (target_srv(&s->target)) {
                                target_srv(&s->target)->counters.failed_resp++;
                                health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_ERROR);
@@ -4758,7 +4756,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
                        if (msg->err_pos >= 0)
                                http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
 
-                       s->be->counters.failed_resp++;
+                       s->be->be_counters.failed_resp++;
                        if (target_srv(&s->target)) {
                                target_srv(&s->target)->counters.failed_resp++;
                                health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_READ_TIMEOUT);
@@ -4783,7 +4781,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
                        if (msg->err_pos >= 0)
                                http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
 
-                       s->be->counters.failed_resp++;
+                       s->be->be_counters.failed_resp++;
                        if (target_srv(&s->target)) {
                                target_srv(&s->target)->counters.failed_resp++;
                                health_adjust(target_srv(&s->target), HANA_STATUS_HTTP_BROKEN_PIPE);
@@ -4808,7 +4806,7 @@ int http_wait_for_response(struct session *s, struct buffer *rep, int an_bit)
                        if (msg->err_pos >= 0)
                                http_capture_bad_message(&s->be->invalid_rep, s, rep, msg, msg->msg_state, s->fe);
 
-                       s->be->counters.failed_resp++;
+                       s->be->be_counters.failed_resp++;
                        rep->analysers = 0;
                        buffer_auto_close(rep);
 
@@ -5130,7 +5128,7 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s
                                                target_srv(&t->target)->counters.failed_resp++;
                                                health_adjust(target_srv(&t->target), HANA_STATUS_HTTP_RSP);
                                        }
-                                       cur_proxy->counters.failed_resp++;
+                                       t->be->be_counters.failed_resp++;
                                return_srv_prx_502:
                                        rep->analysers = 0;
                                        txn->status = 502;
@@ -5150,7 +5148,8 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s
                                if (target_srv(&t->target))
                                        target_srv(&t->target)->counters.failed_secu++;
 
-                               cur_proxy->counters.denied_resp++;
+                               t->be->be_counters.denied_resp++;
+                               t->fe->fe_counters.denied_resp++;
                                if (t->listener->counters)
                                        t->listener->counters->denied_resp++;
 
@@ -5302,7 +5301,8 @@ int http_process_res_common(struct session *t, struct buffer *rep, int an_bit, s
                        if (target_srv(&t->target))
                                target_srv(&t->target)->counters.failed_secu++;
 
-                       cur_proxy->counters.denied_resp++;
+                       t->be->be_counters.denied_resp++;
+                       t->fe->fe_counters.denied_resp++;
                        if (t->listener->counters)
                                t->listener->counters->denied_resp++;
 
@@ -5527,7 +5527,7 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit
        if (res->flags & BF_SHUTR) {
                if (!(s->flags & SN_ERR_MASK))
                        s->flags |= SN_ERR_SRVCL;
-               s->be->counters.srv_aborts++;
+               s->be->be_counters.srv_aborts++;
                if (target_srv(&s->target))
                        target_srv(&s->target)->counters.srv_aborts++;
                goto return_bad_res_stats_ok;
@@ -5565,7 +5565,7 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit
        return 0;
 
  return_bad_res: /* let's centralize all bad responses */
-       s->be->counters.failed_resp++;
+       s->be->be_counters.failed_resp++;
        if (target_srv(&s->target))
                target_srv(&s->target)->counters.failed_resp++;
 
@@ -5591,9 +5591,8 @@ int http_response_forward_body(struct session *s, struct buffer *res, int an_bit
        res->analysers = 0;
        s->req->analysers = 0; /* we're in data phase, we want to abort both directions */
 
-       s->fe->counters.cli_aborts++;
-       if (s->fe != s->be)
-               s->be->counters.cli_aborts++;
+       s->fe->fe_counters.cli_aborts++;
+       s->be->be_counters.cli_aborts++;
        if (target_srv(&s->target))
                target_srv(&s->target)->counters.cli_aborts++;
 
@@ -5677,7 +5676,9 @@ int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hd
                                txn->flags |= TX_CLDENY;
                                last_hdr = 1;
 
-                               t->be->counters.denied_req++;
+                               t->fe->fe_counters.denied_req++;
+                               if (t->fe != t->be)
+                                       t->be->be_counters.denied_req++;
                                if (t->listener->counters)
                                        t->listener->counters->denied_req++;
 
@@ -5687,7 +5688,9 @@ int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hd
                                txn->flags |= TX_CLTARPIT;
                                last_hdr = 1;
 
-                               t->be->counters.denied_req++;
+                               t->fe->fe_counters.denied_req++;
+                               if (t->fe != t->be)
+                                       t->be->be_counters.denied_req++;
                                if (t->listener->counters)
                                        t->listener->counters->denied_req++;
 
@@ -5796,7 +5799,9 @@ int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_e
                case ACT_DENY:
                        txn->flags |= TX_CLDENY;
 
-                       t->be->counters.denied_req++;
+                       t->fe->fe_counters.denied_req++;
+                       if (t->fe != t->be)
+                               t->be->be_counters.denied_req++;
                        if (t->listener->counters)
                                t->listener->counters->denied_req++;
 
@@ -5806,7 +5811,9 @@ int apply_filter_to_req_line(struct session *t, struct buffer *req, struct hdr_e
                case ACT_TARPIT:
                        txn->flags |= TX_CLTARPIT;
 
-                       t->be->counters.denied_req++;
+                       t->fe->fe_counters.denied_req++;
+                       if (t->fe != t->be)
+                               t->be->be_counters.denied_req++;
                        if (t->listener->counters)
                                t->listener->counters->denied_req++;
 
index 04562f10472994bc55302c2cfaff0257d8b4ccf9..d40f85c4198fbc54929daa352ce1597b66f29540 100644 (file)
@@ -726,7 +726,8 @@ int tcp_inspect_request(struct session *s, struct buffer *req, int an_bit)
                                buffer_abort(s->rep);
                                req->analysers = 0;
 
-                               s->be->counters.denied_req++;
+                               s->be->be_counters.denied_req++;
+                               s->fe->fe_counters.denied_req++;
                                if (s->listener->counters)
                                        s->listener->counters->denied_req++;
 
@@ -842,7 +843,8 @@ int tcp_inspect_response(struct session *s, struct buffer *rep, int an_bit)
                                buffer_abort(s->req);
                                rep->analysers = 0;
 
-                               s->be->counters.denied_resp++;
+                               s->be->be_counters.denied_resp++;
+                               s->fe->fe_counters.denied_resp++;
                                if (s->listener->counters)
                                        s->listener->counters->denied_resp++;
 
@@ -894,7 +896,7 @@ int tcp_exec_req_rules(struct session *s)
                if (ret) {
                        /* we have a matching rule. */
                        if (rule->action == TCP_ACT_REJECT) {
-                               s->fe->counters.denied_conn++;
+                               s->fe->fe_counters.denied_conn++;
                                if (s->listener->counters)
                                        s->listener->counters->denied_conn++;
 
index 0c6640e9ba8eacb3d251e93525338f5893483cb5..0129b122ce1c9722e73592dda2809bcfe26257e1 100644 (file)
@@ -536,9 +536,9 @@ void maintain_proxies(int *next)
                                t = tick_remain(now_ms, p->stop_time);
                                if (t == 0) {
                                        Warning("Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
-                                               p->id, p->counters.cum_feconn, p->counters.cum_beconn);
+                                               p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
                                        send_log(p, LOG_WARNING, "Proxy %s stopped (FE: %lld conns, BE: %lld conns).\n",
-                                                p->id, p->counters.cum_feconn, p->counters.cum_beconn);
+                                                p->id, p->fe_counters.cum_conn, p->be_counters.cum_conn);
                                        stop_proxy(p);
                                        /* try to free more memory */
                                        pool_gc2();
@@ -766,8 +766,8 @@ int session_set_backend(struct session *s, struct proxy *be)
                return 1;
        s->be = be;
        be->beconn++;
-       if (be->beconn > be->counters.beconn_max)
-               be->counters.beconn_max = be->beconn;
+       if (be->beconn > be->be_counters.conn_max)
+               be->be_counters.conn_max = be->beconn;
        proxy_inc_be_ctr(be);
 
        /* assign new parameters to the session from the new backend */
index ae9928440beeee1a546e9d8e58ec9ae66e68ab76..48380fcd8e86b448cdb95535f1cd678a4c69dab6 100644 (file)
@@ -159,8 +159,8 @@ struct pendconn *pendconn_add(struct session *sess)
                LIST_ADDQ(&sess->be->pendconns, &p->list);
                sess->be->nbpend++;
                sess->logs.prx_queue_size += sess->be->nbpend;
-               if (sess->be->nbpend > sess->be->counters.nbpend_max)
-                       sess->be->counters.nbpend_max = sess->be->nbpend;
+               if (sess->be->nbpend > sess->be->be_counters.nbpend_max)
+                       sess->be->be_counters.nbpend_max = sess->be->nbpend;
        }
        sess->be->totpend++;
        return p;
index 5cd08532c48088888c99fbf1aba4cc2e871eedb7..21275768e6ec4bb14e88319144fd423ef1dd1388 100644 (file)
@@ -130,8 +130,8 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
        }
 
        /* This session was accepted, count it now */
-       if (p->feconn > p->counters.feconn_max)
-               p->counters.feconn_max = p->feconn;
+       if (p->feconn > p->fe_counters.conn_max)
+               p->fe_counters.conn_max = p->feconn;
 
        proxy_inc_fe_sess_ctr(l, p);
        if (s->stkctr1_entry) {
@@ -410,10 +410,9 @@ void session_process_counters(struct session *s)
                bytes = s->req->total - s->logs.bytes_in;
                s->logs.bytes_in = s->req->total;
                if (bytes) {
-                       s->fe->counters.bytes_in                        += bytes;
+                       s->fe->fe_counters.bytes_in                     += bytes;
 
-                       if (s->be != s->fe)
-                               s->be->counters.bytes_in                += bytes;
+                       s->be->be_counters.bytes_in                     += bytes;
 
                        if (target_srv(&s->target))
                                target_srv(&s->target)->counters.bytes_in               += bytes;
@@ -461,10 +460,9 @@ void session_process_counters(struct session *s)
                bytes = s->rep->total - s->logs.bytes_out;
                s->logs.bytes_out = s->rep->total;
                if (bytes) {
-                       s->fe->counters.bytes_out                       += bytes;
+                       s->fe->fe_counters.bytes_out                    += bytes;
 
-                       if (s->be != s->fe)
-                               s->be->counters.bytes_out               += bytes;
+                       s->be->be_counters.bytes_out                    += bytes;
 
                        if (target_srv(&s->target))
                                target_srv(&s->target)->counters.bytes_out              += bytes;
@@ -606,7 +604,7 @@ int sess_update_st_cer(struct session *s, struct stream_interface *si)
 
                if (target_srv(&s->target))
                        target_srv(&s->target)->counters.failed_conns++;
-               s->be->counters.failed_conns++;
+               s->be->be_counters.failed_conns++;
                sess_change_server(s, NULL);
                if (may_dequeue_tasks(target_srv(&s->target), s->be))
                        process_srv_queue(target_srv(&s->target));
@@ -639,7 +637,7 @@ int sess_update_st_cer(struct session *s, struct stream_interface *si)
        } else {
                if (target_srv(&s->target))
                        target_srv(&s->target)->counters.retries++;
-               s->be->counters.retries++;
+               s->be->be_counters.retries++;
                si->state = SI_ST_ASS;
        }
 
@@ -743,7 +741,7 @@ void sess_update_stream_int(struct session *s, struct stream_interface *si)
                                srv_inc_sess_ctr(srv);
                        if (srv)
                                srv->counters.failed_conns++;
-                       s->be->counters.failed_conns++;
+                       s->be->be_counters.failed_conns++;
 
                        /* release other sessions waiting for this server */
                        sess_change_server(s, NULL);
@@ -799,7 +797,7 @@ void sess_update_stream_int(struct session *s, struct stream_interface *si)
                        s->logs.t_queue = tv_ms_elapsed(&s->logs.tv_accept, &now);
                        if (srv)
                                srv->counters.failed_conns++;
-                       s->be->counters.failed_conns++;
+                       s->be->be_counters.failed_conns++;
                        si->shutr(si);
                        si->shutw(si);
                        si->ob->flags |= BF_WRITE_TIMEOUT;
@@ -1279,7 +1277,8 @@ struct task *process_session(struct task *t)
                        s->si[0].shutw(&s->si[0]);
                        stream_int_report_error(&s->si[0]);
                        if (!(s->req->analysers) && !(s->rep->analysers)) {
-                               s->be->counters.cli_aborts++;
+                               s->be->be_counters.cli_aborts++;
+                               s->fe->fe_counters.cli_aborts++;
                                if (srv)
                                        srv->counters.cli_aborts++;
                                if (!(s->flags & SN_ERR_MASK))
@@ -1295,11 +1294,12 @@ struct task *process_session(struct task *t)
                        s->si[1].shutr(&s->si[1]);
                        s->si[1].shutw(&s->si[1]);
                        stream_int_report_error(&s->si[1]);
-                       s->be->counters.failed_resp++;
+                       s->be->be_counters.failed_resp++;
                        if (srv)
                                srv->counters.failed_resp++;
                        if (!(s->req->analysers) && !(s->rep->analysers)) {
-                               s->be->counters.srv_aborts++;
+                               s->be->be_counters.srv_aborts++;
+                               s->fe->fe_counters.srv_aborts++;
                                if (srv)
                                        srv->counters.srv_aborts++;
                                if (!(s->flags & SN_ERR_MASK))
@@ -1659,25 +1659,29 @@ struct task *process_session(struct task *t)
                        /* Report it if the client got an error or a read timeout expired */
                        s->req->analysers = 0;
                        if (s->req->flags & BF_READ_ERROR) {
-                               s->be->counters.cli_aborts++;
+                               s->be->be_counters.cli_aborts++;
+                               s->fe->fe_counters.cli_aborts++;
                                if (srv)
                                        srv->counters.cli_aborts++;
                                s->flags |= SN_ERR_CLICL;
                        }
                        else if (s->req->flags & BF_READ_TIMEOUT) {
-                               s->be->counters.cli_aborts++;
+                               s->be->be_counters.cli_aborts++;
+                               s->fe->fe_counters.cli_aborts++;
                                if (srv)
                                        srv->counters.cli_aborts++;
                                s->flags |= SN_ERR_CLITO;
                        }
                        else if (s->req->flags & BF_WRITE_ERROR) {
-                               s->be->counters.srv_aborts++;
+                               s->be->be_counters.srv_aborts++;
+                               s->fe->fe_counters.srv_aborts++;
                                if (srv)
                                        srv->counters.srv_aborts++;
                                s->flags |= SN_ERR_SRVCL;
                        }
                        else {
-                               s->be->counters.srv_aborts++;
+                               s->be->be_counters.srv_aborts++;
+                               s->fe->fe_counters.srv_aborts++;
                                if (srv)
                                        srv->counters.srv_aborts++;
                                s->flags |= SN_ERR_SRVTO;
@@ -1688,25 +1692,29 @@ struct task *process_session(struct task *t)
                        /* Report it if the server got an error or a read timeout expired */
                        s->rep->analysers = 0;
                        if (s->rep->flags & BF_READ_ERROR) {
-                               s->be->counters.srv_aborts++;
+                               s->be->be_counters.srv_aborts++;
+                               s->fe->fe_counters.srv_aborts++;
                                if (srv)
                                        srv->counters.srv_aborts++;
                                s->flags |= SN_ERR_SRVCL;
                        }
                        else if (s->rep->flags & BF_READ_TIMEOUT) {
-                               s->be->counters.srv_aborts++;
+                               s->be->be_counters.srv_aborts++;
+                               s->fe->fe_counters.srv_aborts++;
                                if (srv)
                                        srv->counters.srv_aborts++;
                                s->flags |= SN_ERR_SRVTO;
                        }
                        else if (s->rep->flags & BF_WRITE_ERROR) {
-                               s->be->counters.cli_aborts++;
+                               s->be->be_counters.cli_aborts++;
+                               s->fe->fe_counters.cli_aborts++;
                                if (srv)
                                        srv->counters.cli_aborts++;
                                s->flags |= SN_ERR_CLICL;
                        }
                        else {
-                               s->be->counters.cli_aborts++;
+                               s->be->be_counters.cli_aborts++;
+                               s->fe->fe_counters.cli_aborts++;
                                if (srv)
                                        srv->counters.cli_aborts++;
                                s->flags |= SN_ERR_CLITO;
@@ -2063,11 +2071,11 @@ struct task *process_session(struct task *t)
                        n = 0;
 
                if (s->fe->mode == PR_MODE_HTTP)
-                       s->fe->counters.fe.http.rsp[n]++;
+                       s->fe->fe_counters.p.http.rsp[n]++;
 
                if ((s->flags & SN_BE_ASSIGNED) &&
                    (s->be->mode == PR_MODE_HTTP))
-                       s->be->counters.be.http.rsp[n]++;
+                       s->be->be_counters.p.http.rsp[n]++;
        }
 
        /* let's do a final log if we need it */
@@ -2120,7 +2128,7 @@ void sess_set_term_flags(struct session *s)
        if (!(s->flags & SN_FINST_MASK)) {
                if (s->si[1].state < SI_ST_REQ) {
 
-                       s->fe->counters.failed_req++;
+                       s->fe->fe_counters.failed_req++;
                        if (s->listener->counters)
                                s->listener->counters->failed_req++;