From: Olivier Houchard Date: Wed, 15 Jan 2025 15:16:18 +0000 (+0100) Subject: MINOR: Add fields to the per-thread group field in struct server. X-Git-Tag: v3.2-dev5~91 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=59eddabe1699742b3a098d5af4a777a66470f06f;p=thirdparty%2Fhaproxy.git MINOR: Add fields to the per-thread group field in struct server. Add a per-thread group queue and associated fields in per-thread group field in struct server, as well as a new field, queues length. This is currently unused, so should change nothing. --- diff --git a/include/haproxy/server-t.h b/include/haproxy/server-t.h index 17ddb7a4c..ee266c207 100644 --- a/include/haproxy/server-t.h +++ b/include/haproxy/server-t.h @@ -271,8 +271,12 @@ struct srv_per_thread { /* Each server will have one occurrence of this structure per thread group */ struct srv_per_tgroup { + struct queue queue; /* pending connections */ + unsigned int last_other_tgrp_served; /* Last other tgrp we dequeued from */ + unsigned int self_served; /* Number of connection we dequeued from our own queue */ + unsigned int dequeuing; /* non-zero = dequeuing in progress (atomic) */ unsigned int next_takeover; /* thread ID to try to steal connections from next time */ -}; +} THREAD_ALIGNED(64); /* Configure the protocol selection for websocket */ enum __attribute__((__packed__)) srv_ws_mode { @@ -314,7 +318,7 @@ struct server { struct log_target *log_target; /* when 'mode log' is enabled, target facility used to transport log messages */ unsigned maxconn, minconn; /* max # of active sessions (0 = unlimited), min# for dynamic limit. */ struct srv_per_thread *per_thr; /* array of per-thread stuff such as connections lists */ - struct srv_per_tgroup *per_tgrp; /* array of per-tgroup stuff such as idle conns */ + struct srv_per_tgroup *per_tgrp; /* array of per-tgroup stuff such as idle conns and queues */ unsigned int *curr_idle_thr; /* Current number of orphan idling connections per thread */ char *pool_conn_name; @@ -343,6 +347,7 @@ struct server { unsigned rweight; /* remainder of weight in the current LB tree */ unsigned cumulative_weight; /* weight of servers prior to this one in the same group, for chash balancing */ int maxqueue; /* maximum number of pending connections allowed */ + unsigned int queueslength; /* Sum of the length of each queue */ int shard; /* shard (in peers protocol context only) */ int log_bufsize; /* implicit ring bufsize (for log server only - in log backend) */ diff --git a/src/server.c b/src/server.c index 79b56126f..b7f303325 100644 --- a/src/server.c +++ b/src/server.c @@ -5713,6 +5713,9 @@ int srv_init_per_thr(struct server *srv) LIST_INIT(&srv->per_thr[i].idle_conn_list); } + for (i = 0; i < global.nbtgroups; i++) + queue_init(&srv->per_tgrp[i].queue, srv->proxy, srv); + return 0; }