From 7773d87ea6f9a17661be4c144bbe35e141d20a2e Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Sun, 24 Aug 2025 12:38:18 +0200 Subject: [PATCH] CLEANUP: proxy: slightly reorganize fields to plug some holes 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/haproxy/proxy-t.h b/include/haproxy/proxy-t.h index 5e0d5bc4a..055141d0f 100644 --- a/include/haproxy/proxy-t.h +++ b/include/haproxy/proxy-t.h @@ -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 */