I'm developing TCP server in Go which should be able to accept up to 500 simultaneous client connections.
I'm using net.Listen("tcp4", listenerAddress)
to create my TCP listener.
I had a problem on Linux when all the 500 clients connect at the same time - TCP accept queue gets filled up. On my Linux system it was 128. So I solved this by increasing queue size through kernel parameter: sysctl -w net.core.somaxconn=512
.
But how to achieve this in Windows? Looks like on my Windows Server OS queue size is fixed at 200. I don't see any parameters which I could pass to listener by using Go language features and also I'm not very familiar with Windows systems so also didn't find any fix through OS. Currently whenever I try about ~300-400 simultaneous clients queue gets filled up and clients get rejected. Improving listener thread performance or priority (how fast it accepts clients) is also not an option here as all the clients can basically connect at the same time. Don't get me wrong, server is able to handle 500 connections when they are not bursty, opening them at the same time.
0 Answers