MINOR: connection: align toremove_{lock,connections} and cleanup into idle_conns
authorWilly Tarreau <w@1wt.eu>
Sat, 27 Jun 2020 22:19:17 +0000 (00:19 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 28 Jun 2020 08:52:36 +0000 (10:52 +0200)
commit4d82bf5c2e38cb80f45d0b4e15a28aded24faef6
tree69068e9d2decef7fe0a8d3e88486a7327751a023
parentd79422a0ffa8ed926326496f45105e4132ebf5f0
MINOR: connection: align toremove_{lock,connections} and cleanup into idle_conns

We used to have 3 thread-based arrays for toremove_lock, idle_cleanup,
and toremove_connections. The problem is that these items are small,
and that this creates false sharing between threads since it's possible
to pack up to 8-16 of these values into a single cache line. This can
cause real damage where there is contention on the lock.

This patch creates a new array of struct "idle_conns" that is aligned
on a cache line and which contains all three members above. This way
each thread has access to its variables without hindering the other
ones. Just doing this increased the HTTP/1 request rate by 5% on a
16-thread machine.

The definition was moved to connection.{c,h} since it appeared a more
natural evolution of the ongoing changes given that there was already
one of them declared in connection.h previously.
include/haproxy/connection-t.h
include/haproxy/connection.h
include/haproxy/server.h
src/backend.c
src/cfgparse.c
src/connection.c
src/mux_fcgi.c
src/mux_h1.c
src/mux_h2.c
src/server.c