Comparative analysis of three Web servers (Apache, Lighttpd,nginx)

Source: Internet
Author: User
Tags http authentication
1. lighttpd

LIGHTTPD is a feature with very low memory overhead, low CPU usage, good performance, and rich modules. LIGHTTPD is one of the best in many opensource lightweight Web servers. Support FastCGI, CGI, Auth, output compression (outputs compress), URL rewriting, alias and other important functions.

LIGHTTPD uses fastcgi to run PHP, which uses very few PHP processes to respond to a large amount of concurrency.

The advantages of fastcgi are:

· In terms of stability, fastcgi is a separate process pool to run CGI, a single process is dead, the system can easily discard, and then reassign new processes to run the logic.

· From the security perspective, the fastcgi and the host server is completely independent, fastcgi how down will not bring the server down,

· In terms of performance, fastcgi separates the processing of the dynamic logic from the server, and the heavy-duty IO processing is left to the host server, so that the host server can be a single-minded Io, and for a normal dynamic Web page, there may be only a small number of logical processes, A large number of images such as static IO processing do not require the involvement of logic programs (Note 1)

· In terms of extensibility, fastcgi is a neutral technical standard that can be fully supported in any language written processing program (Php,java,python ...).

2.apache

Apache is the world's number one Web server, according to Netcraft (www.netsraft.co.uk) survey, more than 50% of the world's Web servers are using Apache.

In April 1995, the earliest Apache (0.6.2 version) was released by Apache Group. The Apache group is a non-profit organization that operates entirely over the internet, and it determines what should be included in the standard release of the Apache Web server. Allow anyone to modify the concealment, provide new features and transplant it to a new platform, and other work. When the new code is submitted to Apache group, the group reviews its content, tests it, and, if it is satisfied, it is integrated into the main version of Apache.

Features of Apache:

1) can be run on almost all computer platforms.

2) support for the latest http/1.1 protocol

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

4) Support for Universal Gateway Interface (CGI)

5) Support Virtual host.

6) Support HTTP authentication.

7) Integrated Perl.

8) Integrated Proxy Server

9) You can monitor the status of the server through a Web browser, and you can customize the log.

10) Support server-side include command (SSI).

11) Support Secure Socket Layer (SSL).

12) have the ability to track the user's conversational process.

13) Support FastCGI

14) Support Java Servlets

3.nginx

Nginx is a very lightweight HTTP server written by the Russians, Nginx, which is pronounced "engine X", is a high-performance HTTP and reverse proxy server, but also a IMAP/POP3/SMTP proxy server. Nginx was developed by the Russian Igor Sysoev for the second rambler.ru site of Russian traffic.

Nginx is written in an event-driven manner, so it has very good performance and is also a very efficient reverse proxy, load balancing. It has the performance of matching lighttpd, and there is no lighttpd memory leak problem, and lighttpd Mod_proxy has some problems and has not been updated for a long time. However, Nginx does not support CGI operations because it reduces some of the procedural vulnerabilities that can be caused. Therefore, you must use the FastCGI method to execute the PHP program.

Nginx as an HTTP server, has the following basic features:

Handles static files, index files, and automatic indexing; Open file descriptor buffering.

No caching of reverse proxy acceleration, simple load balancing and fault tolerance.

FastCGI, simple load balancing and fault tolerance.

Modular structure. Includes gzipping, byte ranges, chunked responses, and Ssi-filter filter. If more than one SSI exists on a single page by a fastcgi or other proxy server, this processing can run in parallel without waiting for each other.

Nginx is specially developed for performance optimization, and performance is the most important consideration, and the implementation is very focused on efficiency. It supports the kernel poll model, withstands high loads, and reports that it supports up to 50,000 concurrent connections.

Nginx has very high stability. Other HTTP servers, when encountering spikes in access, or when someone maliciously initiates a slow connection, are likely to cause the server to run out of physical memory frequently, lose response, and only restart the server. For example, once Apache has reached more than 200 processes, the Web response is significantly slower. Nginx adopts the phased resource allocation technology, which makes its CPU and memory occupancy rate very low. Nginx official said to maintain 10,000 inactive connections, it only accounted for 2.5M of memory, so a DOS-like attack on Nginx is basically useless. In terms of stability, Nginx is better than lighthttpd.

Nginx supports hot deployment. Its start-up is particularly easy, and it can be run almost 24x7, even if it runs for several months without restarting. You will also be able to upgrade the software version in the event of uninterrupted service.


Server

Apache

Nginx

Lighttpd

Proxy Agent

Very good

Very good

So so

Rewriter

Good

Very good

So so

Fcgi

Not good

Good

Very good

Hot deployment

Not supported

Support

Not supported

System pressure Comparison

Very big

Very small

Relatively small

Stability

Good

Very good

Not good

Security

Good

So so

So so

Technical support

Very good

Rarely

So so

Static file Processing

So so

Very good

Good

Vhosts Virtual Host

Support

Not supported

Support

Reverse Proxy

So so

Very good

So so

Session Sticky

Support

Not supported

Not supported

Note: In relatively large sites, the cost savings of the server is undoubtedly objective. Some small sites tend to have few servers, and if you use a traditional Web server like Apache, it seems to be able to survive. But there are obvious drawbacks: when Apache handles bursts of traffic (such as crawlers or Digg effects), it's easy to overload, so it's best to use Nginx.

Suggested Scenarios:

Apache Background server (main processing PHP and some feature requests such as: Chinese URL )

Nginx Front-end server (use it to take advantage of less system resources to handle static page mass requests)

Lighttpd Image Server

Overall, as Nginx the perfect function will make him a future Web Server to mainstream.


The response time of 3 software to dynamic pages and static page requests and concurrency will be tested separately

l static page Sohu Home

LIGHTTPD

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

100000/100

64

60

462.75

21.6

100000/200

67

60

312.07

32.4

100000/500

83

60

137.24

72.8

100000/1000

Error drops occurred

94

60

126.6

78.9

Nginx

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

100000/100

34.6

140

943.66

10.597

100000/200

35.6

110

924.32

10.818

100000/500

34.3

110

912.68

10.956

100000/1000

37

160

832.59

12.106

Apache

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

100000/100

40.6

170

690.72

14.47

100000/200

41.1

180

685.39

14.59

100000/500

42.3

190

633.64

15.78

100000/1000

43.1

200

547.53

18.26

Dynamic page Internal Community home

LIGHTTPD

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

1000/100

50

200

33.54

29.816

1000/200

52

210

30.43

32.858

1000/500

54

230

25.79

38.76

1000/1000

62

250

24.83

40.28

Nginx

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

1000/100

53.8

250

83.12

12.305

1000/200

55.8

250

74.05

13.504

1000/500

56

260

58.99

16.951

1000/1000

58

260

43.41

23.347

Apache

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

100000/100

60

200

27.37

36.541

100000/200

61

220

23.82

41.981

100000/500

73

150

20.59

48.562

100000/1000

53

200

27.18

36.796

l Phpinfo function page

LIGHTTPD

n/-c (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

100000/100

,

-

168.06

59.504

100000/ $

width=

"

140.64

71.103

100000/500

49

52.80

189.386

100000/1000

Test test program dies when request to 4840

Nginx

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

100000/100

70

120

143.46

69.706

100000/200

72

130

140.57

71.140

100000/500

73

150

135.87

73.601

100000/1000

77

160

132.18

75.657

APACHE appears to drop packets

N/-C (ab parameter)

cpu%

Mem

Requestspersecond

Time taken for tests

100000/100

70

180

245.73

40.694

100000/200

72

190

245.79

40.684

100000/500

75

200

241.29

41.443

100000/1000

77

220

236.74

42.239

Site name operating system Web server

1. Portal Site class:

Sohu LINUX Apache 1.3.37

Sina LINUX Apache 2.0.54

Thunderbolt LINUX Nginx 0.6.31

163 LINUX Apache 2.2.6

2. Search for classes

Baidu Unknown BWS 1.0

Google Linux GWS

Sougou FreeBSD Apache 2.2.4

Hao123 Linux Apache 2.2.4

4. e-Mail class

126 Linux Apache

Hotmail Win2003 Microsoft-iis 6.0

Sina email 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 class

Youku Linux Apache

Potato Linux Apache

Ku6 Linux Apache

Six rooms Linux Nginx 0.6.14

The above describes the three major web server comparative analysis (Apache, Lighttpd,nginx), including aspects of the content, I hope the PHP tutorial interested in a friend helpful.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.