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.
This commit is contained in:
Olivier Houchard 2025-01-15 16:16:18 +01:00 committed by Olivier Houchard
parent f879b9a18a
commit 59eddabe16
2 changed files with 10 additions and 2 deletions

View File

@ -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) */

View File

@ -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;
}