Tuesday 17 December 2019

Maximum number of connections accepted by NGINX


totalNumberOfWorkerProcesses X maximumNumberOfConnectionsForEachWorkerProcess

for example, If I have a system 16 cores and each process can able to accommodate maximum of 256 connections, then total  16 * 256 = 4096 parallel connections are possible.

Command to get total cores and maximum connections
$sysctl hw.physicalcpu hw.logicalcpu
hw.physicalcpu: 8
hw.logicalcpu: 16
$
$ulimit -n
256


nginx.conf
worker_processes auto;

events {
   worker_connections 256; 
}

http {
    include mime.types;

    server {
        listen 9090;

        server_name localhost;

        location = /about{
            return 200 "Hello Welcome to NGINX";
        }

        location = /not_found{
            return 404 "File can't be found";
        }
    }
}





Previous                                                    Next                                                    Home

No comments:

Post a Comment