OPTIM: connection: don't try to kill other threads' connection when !shared

Users may have good reasons for using "tune.idle-pool.shared off", one of
them being the cost of moving cache lines between cores, or the kernel-
side locking associated with moving FDs. For this reason, when getting
close to the file descriptors limits, we must not try to kill adjacent
threads' FDs when the sharing of pools is disabled. This is extremely
expensive and kills the performance. We must limit ourselves to our local
FDs only. In such cases, it's up to the users to configure a large enough
maxconn for their usages.

Before this patch, perf top reported 9% CPU usage in connect_server()
onthe trylock used to kill connections when running at 4800 conns for
a global maxconn of 6400 on a 128-thread server. Now it doesn't spend
its time there anymore, and performance has increased by 12%. Note,
it was verified that disabling the locks in such a case has no effect
at all, so better keep them and stay safe.
This commit is contained in:
Willy Tarreau 2025-02-25 08:42:45 +01:00
parent 2e0bac90da
commit a826250659

View File

@ -1675,6 +1675,9 @@ int connect_server(struct stream *s)
task_wakeup(idle_conns[i].cleanup_task, TASK_WOKEN_OTHER);
break;
}
if (!(global.tune.options & GTUNE_IDLE_POOL_SHARED))
break;
}
}