On Fri, Apr 01, 2022 at 08:58:43AM +0200, Maciej Zdeb wrote: > Hi Willy, > Thanks for the patch! Now I'll be able to rebalance peers connections > manually. Do you know why so many of them are landing on the same thread?
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. 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. For incoming ones it could be a bit trickier because it would require to implement an incoming load-balancing mechanism that is specific to the listener. That wouldn't be stupid in the end, given that we already had to do something specific for QUIC (disable inbound balancing). The difficulty with the peers is that an incoming connection may replace an existing one and we can't know which one. But given that peers connections do not need to deal with high rates and that there are often more threads than connections, we could very well use a max-accept 1 on these ones and carefully scan all threads for peers connections to spot the best one. Willy