MEDIUM: rhttp: support multi-thread active connect
authorAmaury Denoyelle <adenoyelle@haproxy.com>
Wed, 22 Nov 2023 17:02:37 +0000 (18:02 +0100)
committerAmaury Denoyelle <adenoyelle@haproxy.com>
Thu, 23 Nov 2023 16:45:56 +0000 (17:45 +0100)
commit3d0c7f2e2add717b4310ffe4585984612221a971
treea46dddb8067c051820c859fca78a0a01961fe34c
parenta3187fe06c74c80a29a8c790b6d768e76dcb2b04
MEDIUM: rhttp: support multi-thread active connect

Implement support for active HTTP reverse task migration on listener
threads. This operation is done each time a new reversable connection
will be instantiated. Instead of directly allocate the connection, a
lookup is done among all the listener threads.

A comparison is done to select the thread with the smallest number of
current reverse connection. If the thread found is different from the
current one, the connection allocation is delayed and the task
rescheduled on the chosen thread. The connection will then be created
and pinned on the new thread. This mechanisms allows to balance reverse
HTTP connections accross different threads.

Note that rhttp_set_affinity is still defined to disable thread
migration on accept. This is necessary as it's unsafe to move an
existing connection to another thread. However, active reverse task
migration should be sufficient to distribute connections accross several
threads. Better than that, this design allows to differentiate standard
frontend and reversable connections. The latest are designed to be
long-lived so it's useful to have their repartition solely based on
others reversed connections.
src/proto_rhttp.c