pt., 1 kwi 2022 o 09:06 Willy Tarreau <w...@1wt.eu> napisaĆ(a): > I seem to remember a discussion about this in the past and that the > conclusion basically was that outgoing connections are sent on the > "current" thread when the management task creates them, while incoming > connections are balanced depending on the overall process' load.
Yes, that's what I'm observing. High cpu usage is caused by outgoing connections (visible on "show fd" dump - rport=1024) and currently I don't mind the incoming ones because they are balanced pretty well. > I remember mentioning something about trying to change this in the future. > For outgoing connections I think we could try to figure where peers > connections are and always use one least represented thread. > If I understand the code correctly, the peer_session_create() function creates appctx by appctx_new() which allocates all outgoing connections on the current thread "appctx->t = task_new_here();"? So changing peer_session_create() into: static struct appctx *peer_session_create(struct peers *peers, struct peer *peer, int thread) { ... appctx = appctx_new_on(&peer_applet, thread); if (!appctx) goto out_close; ... } where appctx_new_on() is a new function that creates an applet on a specified thread would fix my issue? I'm worrying it's not that easy and some locking here and there might be needed. ;-) Kind regards, Maciej > Willy >