At one time, most administrators of Web servers chose one of two software platforms. Those who preferred Windows used Internet Information Server (IIS) while nearly everyone else went with Apache HTTP Server. Recently, however, the use of Apache has fallen below 50 percent for the first time in more than a decade, and a newer, open-source Web server known as Nginx, is quickly gaining ground.
Although Nginx is now hovering around the 14 percent mark of total Web servers worldwide, IIS has made new gains instead of falling out of the competition as was expected. Despite the popularity contest that is currently ensuing, a quick look at the benchmarks and the pros and cons of each of the top three Web servers reveals that Nginx may be the best option.
About Apache HTTP Server
Apache HTTP Server remains the undisputed leader in Web servers, and experts have cited the following reasons:
• Apache is open-source software, and it is well documented, which provides for valuable and reliable support options.
• Apache is consistently updated with new features.
• Apache can be used free of charge.
• Apache supports multiple hardware and operating system (OS) platforms.
Although Apache has several benefits, it also suffers from a few drawbacks:
• Apache runs at peak performance only with Linux systems.
• Apache’s vast array of options makes system installation and setup confusing or difficult.
• Apache suffers from a high number of vulnerabilities.
IIS is the Web server of choice for several types of systems, including Windows systems and websites running Active Server Pages (ASPs). Webmasters who prefer IIS to other servers note the following advantages:
• IIS is a Microsoft product that integrates well with a Microsoft OS.
• IIS is bundled free with Windows Servers.
• IIS can limit bandwidth availability to specific Web pages.
• IIS includes a superior crash-prevention system.
Like Apache, IIS also suffers from a few disadvantages:
• IIS is limited to Microsoft systems.
• IIS is proprietary software, which means the source code cannot be accessed and customized for each system, application or environment.
• Although IIS is bundled free with NT, NT setup and maintenance is associated with high costs.
Nginx is making headlines as the new Web server of choice for many webmasters. The top reason for its popularity is its speed. Nginx is faster than Apache in non-testing environments because its architecture is event driven while Apache’s is process driven. Nginx is supported on the following OS :FreeBSD, Linux, Solaris, Mac OS X and Windows Server 2003.This makes Nginx the top Web server for multitasking. Other advantages of Nginx are as follows:
• Nginx is fast because it does not need to create a new process for each new request.
• Nginx uses very little memory, especially for static Web pages.
• Nginx can be used with a range of systems.
• Nginx is highly scalable, and performance is not dependent on hardware.
• Nginx is easy to install and configure.
While Nginx is gaining ground in the Web server race, it is known to a have a couple of limited issues:
• Nginx has fewer components for adding new features than are available for Apache.
• Nginx lacks the support options of Apache and IIS.
Web Server Benchmarks
The following benchmarks for Apache, IIS and Nginx were compiled in October 2011. Each Web server is listed in order of performance.
• IIS – 9 percent
• Nginx – 21 percent
• Apache – 26 percent
• IIS – 49,000 responses per second (r/s)
• Nginx – 23,000 r/s
• Apache – 14,000 r/s
• IIS – 2.8 milliseconds
• Nginx – 5.5 milliseconds
• Apache – 6.3 milliseconds
Although IIS scored the best in each category, one caveat must be mentioned. The IIS system used in the benchmarks was running Windows Server 2008 while the Apache and Nginx systems were running CentOS 6.0. When using IIS in conjunction with Windows, speed is impressive, but users must be willing to suffer through all of the drawbacks of Microsoft.
Here’s another benchmark that ran on a different server with a single core :
Nginx Performance Tuning
While the speed of Nginx is already remarkable, this Web server can perform even better when it has been properly configured. Following are a few settings that can be adjusted for Nginx optimal performance:
• Set worker_processes to the maximum allowed.
• Set worker_rlimit_nofile to 200000.
• Log only critical errors.
• Accept the maximum connections by turning multi_accept on.
• Turn access_log off.
• Turn sendfile on.
• Turn ncp_nopush on.
• Turn off data-send buffering with tcp_nodelay.
• Set keepalive_requests to 100000 and keepalive_timeout to 30.
• Turn on reset_timedout_connection.
• Send clients requests for timing out by setting client_body_timeout to 10.
• Free up resources used for stale client connections by setting send_timeout to 2.
• Turn on gzip to compress files before they are transferred.
IIS, when used in conjunction with a Windows OS is fast and reliable. However, those who prefer the configuration options of open-source software will find that Nginx beats Apache on servers with Linux OSs.