Windows – How to set maximum queue connection for nginx port in Windows

nginxwindows

I am learning to design scalable system, for now using Windows machine. I created two servers that will listen to port 27016 and 27015, all they do is return "HelloWorld!" response. I had set listen(ListenSocket, SOMAXCONN) for both the servers when creating them in Visual studio following Winsock tutorial. Using jmter performed load test on each of them individually (1000 request per sec) and got everything OK.

Now when I introduced nginx which is listening to port 80 and load balancing the requests (1000 req per sec) among the two servers I mentioned above, many requests are being dropped down while performing load test using jmeter.

I am assuming that queue size for port 80 is not configured for high traffic and want to tune it. How to set the queue size to maximum possible value either from nginx config or cmd command?

Best Answer

Here is the information from Nginx web site:

worker_processes: The number of NGINX worker processes (the default is 1). In most cases, running one worker process per CPU core works well, and we recommend setting this directive to auto to achieve that. There are times when you may want to increase this number, such as when the worker processes have to do a lot of disk I/O.

worker_connections: The maximum number of connections that each worker process can handle simultaneously. The default is 512, but most systems have enough resources to support a larger number. The appropriate setting depends on the size of the server and the nature of the traffic, and can be discovered through testing.

So, the best choice for worker_processes is the same as the number of cores you have. And the value or worker_connections defaults to 512. You can increase it depending on your needs, and as your system can handle.

The following could be helpfull too:

keepalive_requests : The number of requests a client can make over a single keepalive connection. The default is 100, but a much higher value can be especially useful for testing with a load‑generation tool, which generally sends a large number of requests from a single client.

keepalive_timeout : How long an idle keepalive connection remains open. The following directive relates to upstream keepalives:

keepalive : The number of idle keepalive connections to an upstream server that remain open for each worker process. There is no default value.

I hope this will helps!

Note: I agree with @Alexey Ten