mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-12-01 07:41:07 +01:00
MINOR: quic: use separate global quic_conns FE/BE lists
Each quic_conn instance is stored in a global list. Its purpose is to be able to loop over all known connections during "show quic". Split this into two separate lists for frontend and backend usage. Another change is that closing backend connections do not move into quic_conns_clo list. They remain instead in their original list. The objective of this patch is to reduce the contention between the two sides. Note that this prevents backend connections to be listed in "show quic" now. This will be adjusted in a future patch.
This commit is contained in:
parent
a5801e542d
commit
49e6fca51b
@ -3342,9 +3342,10 @@ show quic [<format>] [<filter>]
|
||||
in the format will instead show a more detailed help message.
|
||||
|
||||
The final argument is used to restrict or extend the connection list. By
|
||||
default, connections on closing or draining state are not displayed. Use the
|
||||
extra argument "all" to include them in the output. It's also possible to
|
||||
restrict to a single connection by specifying its hexadecimal address.
|
||||
default, active frontend connections only are displayed. Use the extra
|
||||
argument "all" to list all connections, including the ones in closing state.
|
||||
It's also possible to restrict to a single connection by specifying its
|
||||
hexadecimal address.
|
||||
|
||||
show servers conn [<backend>]
|
||||
Dump the current and idle connections state of the servers belonging to the
|
||||
|
||||
@ -150,7 +150,8 @@ struct thread_ctx {
|
||||
struct list buffer_wq[DYNBUF_NBQ]; /* buffer waiters, 4 criticality-based queues */
|
||||
struct list pool_lru_head; /* oldest objects in thread-local pool caches */
|
||||
struct list streams; /* list of streams attached to this thread */
|
||||
struct list quic_conns; /* list of active quic-conns attached to this thread */
|
||||
struct list quic_conns_fe; /* list of active FE quic-conns attached to this thread */
|
||||
struct list quic_conns_be; /* list of active BE quic-conns attached to this thread */
|
||||
struct list quic_conns_clo; /* list of closing quic-conns attached to this thread */
|
||||
struct list queued_checks; /* checks waiting for a connection slot */
|
||||
struct list tasklets[TL_CLASSES]; /* tasklets (and/or tasks) to run, by class */
|
||||
|
||||
@ -93,9 +93,9 @@ static int cli_parse_show_quic(char **args, char *payload, struct appctx *appctx
|
||||
" of levels among 'tp', 'sock', 'pktns', 'cc', or 'mux'\n"
|
||||
" help display this help\n"
|
||||
"Available output filters:\n"
|
||||
" all dump all connections (the default)\n"
|
||||
" all dump all connections\n"
|
||||
" <id> dump only the connection matching this identifier (0x...)\n"
|
||||
"Without any argument, all connections are dumped using the oneline format.\n");
|
||||
"Without any argument, active frontend connections are dumped using the oneline format.\n");
|
||||
return cli_err(appctx, trash.area);
|
||||
}
|
||||
else if (*args[argc]) {
|
||||
@ -452,7 +452,7 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
|
||||
}
|
||||
else if (!ctx->bref.ref) {
|
||||
/* First invocation. */
|
||||
ctx->bref.ref = ha_thread_ctx[ctx->thr].quic_conns.n;
|
||||
ctx->bref.ref = ha_thread_ctx[ctx->thr].quic_conns_fe.n;
|
||||
|
||||
/* Print legend for oneline format. */
|
||||
if (cli_show_quic_format(ctx) == QUIC_DUMP_FMT_ONELINE) {
|
||||
@ -470,7 +470,7 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
|
||||
while (1) {
|
||||
int done = 0;
|
||||
|
||||
if (ctx->bref.ref == &ha_thread_ctx[ctx->thr].quic_conns) {
|
||||
if (ctx->bref.ref == &ha_thread_ctx[ctx->thr].quic_conns_fe) {
|
||||
/* If closing connections requested through "all" or a
|
||||
* specific connection is filtered, move to
|
||||
* quic_conns_clo list after browsing quic_conns. Else
|
||||
@ -505,7 +505,7 @@ static int cli_io_handler_dump_quic(struct appctx *appctx)
|
||||
if (ctx->thr >= global.nbthread)
|
||||
break;
|
||||
/* Switch to next thread quic_conns list. */
|
||||
ctx->bref.ref = ha_thread_ctx[ctx->thr].quic_conns.n;
|
||||
ctx->bref.ref = ha_thread_ctx[ctx->thr].quic_conns_fe.n;
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -572,7 +572,8 @@ static void cli_quic_init()
|
||||
int thr;
|
||||
|
||||
for (thr = 0; thr < MAX_THREADS; ++thr) {
|
||||
LIST_INIT(&ha_thread_ctx[thr].quic_conns);
|
||||
LIST_INIT(&ha_thread_ctx[thr].quic_conns_fe);
|
||||
LIST_INIT(&ha_thread_ctx[thr].quic_conns_be);
|
||||
LIST_INIT(&ha_thread_ctx[thr].quic_conns_clo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -445,7 +445,8 @@ void qc_detach_th_ctx_list(struct quic_conn *qc, int closing)
|
||||
LIST_DEL_INIT(&bref->users);
|
||||
|
||||
/* Attach it to next instance unless it was the last list element. */
|
||||
if (qc->el_th_ctx.n != &th_ctx->quic_conns &&
|
||||
if (qc->el_th_ctx.n != &th_ctx->quic_conns_fe &&
|
||||
qc->el_th_ctx.n != &th_ctx->quic_conns_be &&
|
||||
qc->el_th_ctx.n != &th_ctx->quic_conns_clo) {
|
||||
struct quic_conn *next = LIST_NEXT(&qc->el_th_ctx,
|
||||
struct quic_conn *,
|
||||
@ -459,7 +460,7 @@ void qc_detach_th_ctx_list(struct quic_conn *qc, int closing)
|
||||
/* Remove quic_conn from global ha_thread_ctx list. */
|
||||
LIST_DEL_INIT(&qc->el_th_ctx);
|
||||
|
||||
if (closing)
|
||||
if (closing && !qc_is_back(qc))
|
||||
LIST_APPEND(&th_ctx->quic_conns_clo, &qc->el_th_ctx);
|
||||
}
|
||||
|
||||
@ -1398,7 +1399,10 @@ struct quic_conn *qc_new_conn(void *target,
|
||||
/* Counters initialization */
|
||||
memset(&qc->cntrs, 0, sizeof qc->cntrs);
|
||||
|
||||
LIST_APPEND(&th_ctx->quic_conns, &qc->el_th_ctx);
|
||||
if (!qc_is_back(qc))
|
||||
LIST_APPEND(&th_ctx->quic_conns_fe, &qc->el_th_ctx);
|
||||
else
|
||||
LIST_APPEND(&th_ctx->quic_conns_be, &qc->el_th_ctx);
|
||||
qc->qc_epoch = HA_ATOMIC_LOAD(&qc_epoch);
|
||||
|
||||
TRACE_LEAVE(QUIC_EV_CONN_INIT, qc);
|
||||
@ -2137,7 +2141,7 @@ void qc_finalize_tid_rebind(struct quic_conn *qc)
|
||||
BUG_ON(qc->flags & (QUIC_FL_CONN_CLOSING|QUIC_FL_CONN_DRAINING));
|
||||
|
||||
/* Reinsert connection in ha_thread_ctx global list. */
|
||||
LIST_APPEND(&th_ctx->quic_conns, &qc->el_th_ctx);
|
||||
LIST_APPEND(&th_ctx->quic_conns_fe, &qc->el_th_ctx);
|
||||
qc->qc_epoch = HA_ATOMIC_LOAD(&qc_epoch);
|
||||
|
||||
/* Reactivate FD polling if connection socket is active. */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user