performance problems with large experiments #3238
-
I'm trying to run some relatively large experiments (a few million concurrent connections for bootstrapping on top of a tor 10% network), but am running into issues with performance. There seems to be an elbow in performance, because ~1 million connections works okay, but much beyond that and I can make barely any progress. Poking around with perf and gdb seems to blame (as of git rev d7966a7):
The stack trace is much deeper than that, but that seems to cover the relevant bits. In particular, it looks like the problem is when trying to find a socket, the hash table is missing and doing a linear search in something that's way too big. Should I be spreading these connections over a larger number of hosts (I'm currently just scaling connections on a fixed number of clients), or is this hash table global? Are there patches to shadow I can make to avoid the linear lookup without breaking things? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
In the simulation, is it a 10% network that's been bootstrapped, and then you're running something on top which establishes ~1 million additional connections? And you're scaling up the number of these concurrent connections while using the same number of hosts? Ideally there shouldn't be an elbow in performance like that. As for the hash table stuff, that linear search was needed at one point to be able to support the migration of C sockets to rust, but I don't think I considered that it would become a performance-sensitive linear search at the time. I think this is only used to prevent adding duplicate sockets to the network interface's priority queue, so it would make sense that the performance gets worse as the network interface has more sockets trying to send at the same time (so the queue is generally larger). I'll take a look tomorrow to see if that's still needed and what can be done about that. There's also the round-robin queuing discipline, but that has always used a |
Beta Was this translation helpful? Give feedback.
@jtracey Can you try with the commits from #3239 (edit: one commit was split off into #3240) and see if it scales any better? It might be a few percent slower in the general case due to a more-expensive hash function, but removes the linear search.