Comparative analysis of three major WEB servers (apache, lighttpd, nginx)

one. Software introduction (apache lighttpd nginx)

1. lighttpd

Lighttpd is a feature with very low memory overhead, low CPU usage, good performance, and rich modules. lighttpd is an excellent one among many OpenSource lightweight web servers. Support FastCGI, CGI, Auth, output compression (output compress), URL rewriting, Alias ​​and other important functions.

Lighttpd uses fastcgi to run php, which responds to a large amount of concurrency with very few PHP processes.

The advantages of Fastcgi are:

From the point of view of stability, fastcgi runs cgi with an independent process pool. When a single process dies, the system can easily discard it, and then reassign new processes to run the logic.

From security From the above, fastcgi and the host server are completely independent. No matter how fastcgi is down, the server will not collapse.

From the performance point of view, fastcgi separates the processing of dynamic logic from the server, and the heavy load IO processing is left to the host server. , so that the host server can do IO wholeheartedly. For an ordinary dynamic web page, the logic processing may only be a small part, and the static IO processing such as a large number of pictures does not need the participation of the logic program at all (Note 1)

In terms of scalability , fastcgi is a neutral technical standard that can fully support handlers written in any language (php, java, python...)

2.apache

Apache is the number one web server in the world. According to a survey by netcraft (www.netsraft.co.uk), more than 50% of the world's web servers are using apache.

In April 1995, the earliest apache (0.6 .2) is published and distributed by the apache group. The apache group is a non-profit organization that operates entirely over the internet, and it decides what should be included in the standard distribution of the apache web server. Anyone is allowed to fix bugs and provide new features and porting it to new platforms, as well as other work. When new code is submitted to the apache group, the group reviews its specifics, tests it, and if satisfied, the code is integrated into The main distribution of apache.

apache features:

1) can run on almost all computer platforms.

2) supports the latest http/1.1 protocol

3) simple and powerful file-based configuration (httpd.conf).

4 ) Support Common Gateway Interface (cgi)

5) Support virtual host.

6) Support http authentication.

7) Integrate perl. 8

) Integrate proxy

server

Support server-side include commands (ssi).

11) Support secure socket layer (ssl).

12) Track user session process.

13) Support fastcgi

14) Support java servlets

3.nginx

Nginx is a very lightweight HTTP server written by Russians. Nginx, which is pronounced "engine X", is a high-performance HTTP and reverse proxy server, as well as an IMAP/POP3/SMTP proxy server. Nginx was developed by Russian Igor Sysoev for the second most visited Rambler.ru site in Russia.

Nginx is written in an event-driven way, so it has very good performance, and is also a very efficient reverse proxy and load balancing. It has the same performance as Lighttpd without the memory leak of Lighttpd, and Lighttpd's mod_proxy also has some problems and has not been updated for a long time. However, Nginx does not support cgi operation, because it can reduce some program loopholes. So you must use FastCGI to execute PHP programs.

As an HTTP server, nginx has the following basic features:

processing static files, indexing files and automatic indexing; opening file descriptor buffering.

Cacheless reverse proxy acceleration, simple load balancing and fault tolerance.

FastCGI, simple load balancing and fault tolerance.

Modular structure. Including filters such as gzipping, byte ranges, chunked responses, and SSI-filter. If multiple SSIs present on a single page are processed by FastCGI or other proxy servers, this processing can run in parallel without waiting for each other.

Nginx is specially developed for performance optimization, performance is its most important consideration, and the implementation pays great attention to efficiency. It supports the kernel Poll model, can withstand the test of high load, and reports indicate that it can support up to 50,000 concurrent connections.

Nginx has high stability. For other HTTP servers, when there is a peak of access or someone maliciously initiates a slow connection, it is very likely that the physical memory of the server will be exhausted and frequently exchanged, and the response will be lost, and the server can only be restarted. For example, once the current apache reaches more than 200 processes, the web response speed is obviously very slow. Nginx adopts a staged resource allocation technology, which makes its CPU and memory usage very low. nginx official said to maintain 10,000 inactive connections, it only occupies 2.5M memory, so attacks like DOS are basically useless to nginx. In terms of stability, nginx is better than lighthttpd.

Nginx supports hot deployment. It is particularly easy to start, and can run almost 24/7 without restarting even if it runs for several months. You can also upgrade the software version without interruption of service.

2. Comparison of 3 kinds of WEB servers:


Note: In a relatively large website, the server cost saved is undoubtedly objective. And some small websites often have few servers. If they use traditional Web servers such as Apache, they seem to be able to survive. But there are obvious drawbacks: Apache is easily overloaded when dealing with traffic bursts (such as crawler or Digg effect), and Nginx is the most suitable in this case.

Suggested solution:

Apache backend server (mainly processing php and some functional requests such as: Chinese url)

Nginx front-end server (using its advantage of occupying less system resources to handle a large number of requests for static pages)

Lighttpd image server In

general , with the development of nginx functions Perfection will make him become the mainstream of web server in the future.

3. Performance test:

The response time of the three types of software will be tested separately for dynamic and static page requests and concurrency

l Dynamic page internal community home page


l PHPINFO function page


IV . List of WEB server resources of major websites

Website

name Operating system 1.0 Google linux gws Sougou FreeBSD apache 2.2.4 Hao123 linux apache 2.2.4 4. Email class 126 linux apache Hotmail win2003 microsoft-IIS 6.0 Sina mailbox F5 Big-IP apache 2.2.8 263 linux apache 2.2.6 5. Blog class































Sina blog linux nginx 0.5.35

Sohu blog linux nginx

Thunder blog linux nginx 0.6.32

Tianya blog F5 Big-IP Microsoft-IIS/5.0

6.

Video Youku linux apache

potato linux apache

Ku6 linux apache

six rooms linux nginx 0.6.14

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327073451&siteId=291194637