Closed pvictorlv closed 6 years ago
from https://pastebin.com/Fn3WnQ1N ChildServerWorkers = new MultithreadEventLoopGroup(1);
You are using ONE thread to handle all client connection tasks! If you are serving large amount of client connections, you'd better use multiple threads(event loops).
// This will spawn threads equal to the number of CPU cores ChildServerWorkers = new MultithreadEventLoopGroup();
@darkinghb considering there's a good amount of unknown code in here, any chance something there might be blocking? That might explain stalls or unnaturally low throughput.
it better run a task handle request in channleread.
@StormHub I've changed to 8, but same thing, when i don't limit it, it use 100% cpu, any idea?
@darkinghb It is recommended to be the same as number of CPUs (default). BTW: Whats the platform you are running on? There are a few things you can try set the backlog to 8192 might help a bit. And whats the actually SoRcvbuf value (GameSocketManagerStatics.BufferSize) The CPU busy probably is caused by large number of task wait spins (but you need to profile to know for sure)
I'm running on windows server 2016 (.net 4.7, cpu xeon 10x2.6ghz), i can post here profile tests later (at night), i'll set the backlog and increase the limit of MultithreadEventLoopGroup and test.
the buffersize is 8192
@darkinghb if CPU is a bottleneck - profile. Check PerfView. It will give you enough of an insight into the situation. I'm quite positive DotNetty can handle 100K connections on a single VM with no problem (given traffic is small over most of them).
Closing for the lack of updates. Feel free to reopen if there's further concern with this.
I've tested dotnetty in my server with 500+ connections and when reach in 100~150 it just don't accept more connections. My server is an game server.
Here is my code: https://pastebin.com/Tr7gajmN
https://pastebin.com/Fn3WnQ1N