Posted by Oodles Admin | Last Updated: 07-Sep-16
Non blocking EDA -
NginX comes with a vital characteristics i.e. it uses non-blocking event-driven method. That mean operations among all possible network connections executes in non-blocking way. In some of the cases, socket interfaces are blocked while some of the socket interface returns the results immediately. Socket() and setsockopt() returns results without blocking, whereas connect(), recv() send() and close() might experience blocking in some of the cases. After confirming that there will be no appearance of lags, these functions are called by Nginx. In order to prevent blocking, as for connect(), socket is changed in advance to non-blocking using ioctl().
By the use of networks, the web server processes make request from the web browser. So, event driven way is followed in the operation of internal NginX. Codes for calling send() or recv() are composed in event-driven format. Each event is composed of a socket, a socket state and an operating function.
Use of Single or no thread -
The pre-set number of worker processes are identified to operate the NginX. Each single thread is identified as a single process. But each single worker process is capable of handling multiple clients at once. So, it clearly shows that it make use of relatively very less multi-threads due to Non-Blocking EDA which handles multiple client request in a single process.
According to W3Techs.com, the below graphical representation indicates that 24% of the websites are using NginX.
Memory Usage :
According to Dreamhost Wiki, Below graphical representation of memory usage clearly shows that NginX has minimum memory consumption.
Request Per Second :
Now let’s compare request per second for well known web servers as per DreamHost wiki analysis. We can observe NginX serves high number of request per second as compared to rest two.
High in performance
NginX has been marked to record high performance than Apache
Handle more clients with less number of process
NginX require very less memory as far more clients can be supported with minimum or no thread. Hence very little memory is utilized as compared to Apache which needs one thread/process or each client.
Difficulties in module creation
Apache has a function called APR (Apache Portable Runtime) which helps Apache in creating modules, while Ngin is missing with such interface called APR. So, under such scenario, the creator of Nginx have to find a module creating function within the internal code of Nginx.
Difficulties in supporting HTTP/1.0 with backend communication
HTTP/1.1 is used for the communication between web servers while NginX uses only 1.0 to interact with backend server. Fortunately, the development of AJP module, can now replace HTTP/1.0 to connect Nginx and Tomcat.