]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: proxy: slightly reorganize fields to plug some holes
authorWilly Tarreau <w@1wt.eu>
Sun, 24 Aug 2025 10:38:18 +0000 (12:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 16 Sep 2025 07:23:46 +0000 (09:23 +0200)
The proxy struct has several small holes that deserved being plugged by
moving a few fields around. Now we're down to 3056 from 3072 previously,
and the remaining holes are small.

At the moment, compared to before this series, we're seeing these
sizes:

    type\size   7d554ca62   current  delta
    listener       752        704     -48  (-6.4%)
    server        4032       3840    -192  (-4.8%)
    proxy         3184       3056    -128  (-4%)
    stktable      3392       3328     -64  (-1.9%)

Configs with many servers have shrunk by about 4% in RAM and configs
with many proxies by about 3%.

include/haproxy/proxy-t.h

index 5e0d5bc4a7eee7acd6a4bbb85f1b5b28c12c551b..055141d0ff0f05904033b0b86d199af50c744d08 100644 (file)
@@ -311,6 +311,7 @@ struct proxy {
        char flags;                             /* bit field PR_FL_* */
        enum pr_mode mode;                      /* mode = PR_MODE_TCP, PR_MODE_HTTP, ... */
        char cap;                               /* supported capabilities (PR_CAP_*) */
+       int to_log;                             /* things to be logged (LW_*), special value LW_LOGSTEPS == follow log-steps */
        unsigned long last_change;              /* internal use only: last time the proxy state was changed */
 
        struct list global_list;                /* list member for global proxy list */
@@ -378,6 +379,7 @@ struct proxy {
        int srvtcpka_cnt;                       /* The maximum number of keepalive probes TCP should send before dropping the connection. (server side) */
        int srvtcpka_idle;                      /* The time (in seconds) the connection needs to remain idle before TCP starts sending keepalive probes. (server side) */
        int srvtcpka_intvl;                     /* The time (in seconds) between individual keepalive probes. (server side) */
+       unsigned int tot_fe_maxconn;            /* #maxconn of frontends linked to that backend, it is used to compute fullconn */
        struct ist monitor_uri;                 /* a special URI to which we respond with HTTP/200 OK */
        struct list mon_fail_cond;              /* list of conditions to fail monitoring requests (chained) */
        struct {                                /* WARNING! check proxy_reset_timeouts() in proxy.h !!! */
@@ -404,7 +406,6 @@ struct proxy {
        unsigned int feconn, beconn;            /* # of active frontend and backends streams */
        unsigned int fe_sps_lim;                /* limit on new sessions per second on the frontend */
        unsigned int fullconn;                  /* #conns on backend above which servers are used at full load */
-       unsigned int tot_fe_maxconn;            /* #maxconn of frontends linked to that backend, it is used to compute fullconn */
        struct ist server_id_hdr_name;                   /* the header to use to send the server id (name) */
        int conn_retries;                       /* maximum number of connect retries */
        unsigned int retry_type;                /* Type of retry allowed */
@@ -423,7 +424,6 @@ struct proxy {
        struct buffer log_tag;                   /* override default syslog tag */
        struct ist header_unique_id;            /* unique-id header */
        struct lf_expr format_unique_id;        /* unique-id format */
-       int to_log;                             /* things to be logged (LW_*), special value LW_LOGSTEPS == follow log-steps */
        int nb_req_cap, nb_rsp_cap;             /* # of headers to be captured */
        struct cap_hdr *req_cap;                /* chained list of request headers to be captured */
        struct cap_hdr *rsp_cap;                /* chained list of response headers to be captured */