Technology


A Comparison Between Popular Web Servers

According to a census held in January 2012, Apache servers hold 64.9% of the market share, the highest in the category of web servers used to power a website, even though it is not advisable to overlay high traffic websites on Apache web servers. The third most popular web server according to the same survey is Nginx which holds only 9.63% of the total websites. Though its market share is quite modest, it is giving a tuff competition to Apache in terms of traffic handling and its load balancing capabilities.

Even some famous websites like Wordspress.com & pinterest.com are believed to deploy Nginx as a web server for their portals instead of Apache. The reason of such belief is the resource optimization, high traffic handling and load balancing capabilities of Nginx, which Apache surely lacks.

Nginx, publicly released in 2004, is an open source, free, http, reverse proxy as well as IMAP/POP3 proxy server. Nginx, pronounced as “Engine-x”, is known for its

  1. stability
  2. low consumption of resources
  3. High traffic handling and performance

Nginx is capable of handling up to 10,000 requests per second with the usage of minimum server resources. In contrast to the process based model of Apache which exhausts under high traffic condition, Nginx overlays its working criteria on a non-blocking event based model. While using a php website with Apache server:

  1. Initially user makes a request to access the website so Apache server, embedded with php binary, allocates a process for the request.
  2. Since php binary is embedded, it supports the fast communication between the process and php website but it also consumes about 20-50 MB of RAM per process.
  3. Another point to be noted is that Apache cannot handle multiple requests simultaneously, so it creates a child process for each parent process to handle multiple requests, which again consumes 20-50 MB of RAM for each sub process.
  4. After a user’s request is granted, multiple processes are generated for this user because a webpage has more than one element to process like CSS, JavaScript, images and other files.
  5. From the above point we can conclude the problem in high traffic conditions because memory resources at server will exhaust rapidly, causing the server to use virtual memory which further slows down the processing speed.
  6. Moreover, until the connection is not terminated, each process remains tied to the request in case there is any kind of delay in execution due to slow internet connection, processing load etc. This causes hundreds of processes to remain pending creating a delay and in high traffic conditions, server will ultimately crash.

On the other hand, Nginx server creates an event for subsequent requests made by the user. This means that,

  1. Initially when a user requests the access, a process is created for the user and when further requests are generated from the same user, an event is triggered. These events are monitored and controlled by the process either in parallel or in sequential manner, as the scheduling of events is drafted.
  2. This saves a large amount of un-necessary memory consumption by small or static processes was the problem with Apache server.
  3. However, php binary cannot be embedded in Nginx server so to overcome this problem ‘php with FastCGI’ or ‘Apache+mod_php’ process is created in background to handle php requests.
  4. So, whenever a static request is made from user, it is handled by Nginx and all php requests are bypassed to the backend process. When a request is processed, it responds to the user. During this time, Nginx handles other events and on receiving the reply from php process, it allocates another request to this backend process. This optimizes the different resources for maximum productivity.
  5. Nginx can also be used as a load balancer under extremely high traffic conditions. It distributes the traffic request to other backend servers sustaining the amount of processing time for every request. This is called as the “reverse proxy” mode.

So even if a website’s requirement is to deploy an Apache server, Nginx can still be deployed to handle high traffic and using the reverse proxy mode, Apache requests can be distributed among various Apache server in backend. This makes Nginx a universal and high performance server for every type of website and traffic handling requirement.

Tags: , , , ,

3 Responses to “A Comparison Between Popular Web Servers”

  1. rapid prototyping Says:

    Yes comparison is very nice here. I liked it.

  2. ProActive Technology Says:

    Hey thanks for the comparison. I wasn’t aware Nginx could be so useful.

  3. admin Says:

    Thanks for dropping by. Good to know you learned something new !

Social Share Toolbar

Leave a Reply

 
 
Customer Speaks
 
 
Our Team Lead from Q3 was in Chicago with AMB this week. We have been involved in many demonstrations and meetings with customers and partners including Microsoft. We have been asking a lot of the Q3 AMB Team and they have surpassed my expectations on deliverables and efforts to deliver new features and functions, such as the new Address Correction, Cross Database, the e-commerce website, new data sources, testing - this product is near impossible to break, and more. These have been important for all of our prospects, customers and business partnerships.

I truly thank the team for their professionalism, efforts beyond most others and retaining a great and excited attitude and work ethic. Though I must say they have worked with these ethics and strength from their first days on this project.

For these reasons AMB has very long plans for utilizing Q3 and this team for years to come. Thank you, Q3 AMB Team !!
Steven Meister
CEO, AMB Dataminers Inc.
»  More Testimonials