Client connection time when a large number of clients connect. #193
Replies: 1 comment 3 replies
-
Hi @markregel2 thanks for your note. In general, any server side interface, that is TCP-based is going to have a bit of headache with connection set up, teardown, and management. This one is no different. I assume it has to do with how the thread pool is managed, but it could also be because it's just using the underlying OS TCP mechanisms. you can try changing thread, pool sizes and such to mitigate problems with the underlying reallocations that have to happen in the operating system for situations where you were operating with a large number of tasks. But I've never really had luck mitigating this exact issue. It's present in all of my libraries. |
Beta Was this translation helpful? Give feedback.
-
Hi @jchristn,
I'm using this as a server to support a communication platform for a system of IoT devices. For testing I wrote an app to create virtual clients, this allows me to have any number of clients connect to the server. The use case is any client can communicate with one or more (or all) of the currently connected clients. This is working well. My question is about the time it takes clients to connect. The virtual clients all attempt to connect at the same time (basically in a For Loop in the code). With a small number of clients (10 - 20), they all connect almost instantly. With 100 clients, the first few connect instantly, then things really slow down. It is taking one to two minutes for all 100 to connect. Do you have an idea why it is bogging down? I have another old native Win32 server (using TCPListner) running synchronously in a thread. It also slows down somewhat but it only takes a few seconds for 100 connections. Could it be related to the asynchronous methods used in this server, or perhaps that its built on .NET? Its not a deal breaker, but I would like to understand why it is so much slower accepting incoming connections.
Thanks and regards.
Beta Was this translation helpful? Give feedback.
All reactions