mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 23:56:57 +02:00
In conn_backend_get() we can cause some extreme contention due to the idle_conns_lock. Indeed, even though it's per-thread, it still causes high contention when running with many threads. The reason is that all threads which do not have any idle connections are quickly skipped, till the point where there are still some, so the first reaching that point will grab the lock and the other ones wait behind. From this point, all threads are synchronized waiting on the same lock, and will follow the leader in small jumps, all hindering each other. Here instead of doing this we're using a trylock. This way when a thread is already checking a list, other ones will continue to next thread. In the worst case, a high contention will lead to a few new connections to be set up, but this may actually be what is required to avoid contention in the first place. With this change, the contention has mostly disappeared on this lock (it's still present in muxes and transport layers due to the takeover). Surprisingly, checking for emptiness of the tree root before taking the lock didn't address any contention. A few improvements are still possible and desirable here. The first one would be to avoid seeing all threads jump to the next one. We could have each thread use a different prime number as the increment so as to spread them across the entire table instead of keeping them synchronized. The second one is that the lock in the muck layers shouldn't be needed to check for the tasklet's context availability. |
||
---|---|---|
.github | ||
contrib | ||
doc | ||
examples | ||
include | ||
reg-tests | ||
scripts | ||
src | ||
tests | ||
.cirrus.yml | ||
.gitattributes | ||
.gitignore | ||
.travis.yml | ||
BRANCHES | ||
CHANGELOG | ||
CONTRIBUTING | ||
INSTALL | ||
LICENSE | ||
MAINTAINERS | ||
Makefile | ||
README | ||
ROADMAP | ||
SUBVERS | ||
VERDATE | ||
VERSION |
The HAProxy documentation has been split into a number of different files for ease of use. Please refer to the following files depending on what you're looking for : - INSTALL for instructions on how to build and install HAProxy - BRANCHES to understand the project's life cycle and what version to use - LICENSE for the project's license - CONTRIBUTING for the process to follow to submit contributions The more detailed documentation is located into the doc/ directory : - doc/intro.txt for a quick introduction on HAProxy - doc/configuration.txt for the configuration's reference manual - doc/lua.txt for the Lua's reference manual - doc/SPOE.txt for how to use the SPOE engine - doc/network-namespaces.txt for how to use network namespaces under Linux - doc/management.txt for the management guide - doc/regression-testing.txt for how to use the regression testing suite - doc/peers.txt for the peers protocol reference - doc/coding-style.txt for how to adopt HAProxy's coding style - doc/internals for developer-specific documentation (not all up to date)