OPTIM: server: switch the actconn list to an mt-list
The remaining contention on the server lock solely comes from
sess_change_server() which takes the lock to add and remove a
stream from the server's actconn list. This is both expensive
and pointless since we have mt-lists, and this list is only
used by the CLI's "shutdown server sessions" command!
Let's migrate to an mt-list and remove the need for this costly
lock. By doing so, the request rate increased by ~1.8%.
diff --git a/src/server.c b/src/server.c
index da6ee52..19bf529 100644
--- a/src/server.c
+++ b/src/server.c
@@ -900,9 +900,10 @@
*/
void srv_shutdown_streams(struct server *srv, int why)
{
- struct stream *stream, *stream_bck;
+ struct stream *stream;
+ struct mt_list *elt1, elt2;
- list_for_each_entry_safe(stream, stream_bck, &srv->actconns, by_srv)
+ mt_list_for_each_entry_safe(stream, &srv->actconns, by_srv, elt1, elt2)
if (stream->srv_conn == srv)
stream_shutdown(stream, why);
}
@@ -1757,7 +1758,7 @@
srv->obj_type = OBJ_TYPE_SERVER;
srv->proxy = proxy;
- LIST_INIT(&srv->actconns);
+ MT_LIST_INIT(&srv->actconns);
srv->pendconns = EB_ROOT;
srv->next_state = SRV_ST_RUNNING; /* early server setup */