Tuesday, January 26, 2016

Nginx+PHP scalability on Windows



I'm trying to understand Nginx+PHP scalability running Windows with, lets say, 100 requests doing a medium-term operations.



Analyzing source code I saw:





  1. Nginx start a spawns itself several times depending on
    configuration and/or server processors count.


  2. Altough it uses I/O completion ports, each worker only creates
    one thread to handle requests.


  3. When a PHP request is done, Nginx communicates with PHP using FastCGI




At this point, although NGinx can continue scaling, I cannot see in standard PHP fastcgi sapi code that scales using multiple threads/processes and completion ports.



For unix/linux, PHP-FPM come to solve the problem because it forks child processes to complete tasks altough not sure about the performance.




But back into Windows, still in PHP-FPM, I don't see specific code to mantain the whole webserver performance high.



Is there an alternative for Windows? Is something wrong in my research?


Answer



The scalability of nginx on Windows is limited, so it's not a recommended platform for a production web site.



From the nginx web site:





Version of nginx for Windows uses the native Win32 API (not the Cygwin emulation layer). Only the select() connection processing method is currently used, so high performance and scalability should not be expected.



Although several workers can be started, only one of them actually does any work.



A worker can handle no more than 1024 simultaneous connections.



No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...