Software introduction (APACHE Lighttpd nginx)

Source: Internet
Author: User
Tags http authentication

1. Lighttpd
Lighttpd features low memory overhead, low CPU usage, good performance, and rich modules. Lighttpd is one of the many opensource lightweight Web servers. Supports important functions such as FastCGI, CGI, auth, output compress, URL rewriting, and alias.
Lighttpd uses FastCGI to run php, which uses a small number of PHP processes to respond to a large amount of concurrency.
FastCGI has the following advantages:
· In terms of stability, FastCGI uses an independent process pool to run CGI. When a single process dies, the system can easily discard it and re-allocate a new process to run the logic.
· In terms of security, FastCGI is completely independent from the host server, and FastCGI will not crash the server even if it is down,
· In terms of performance, FastCGI separates the processing of dynamic logic from the server, leaving heavy-load Io processing to the host server, so that the host server can work with IO with one mind, for a common dynamic web page, logical processing may only be a small part. Static Io processing, such as a large number of images, does not require the participation of Logic Programs (note 1)
· In terms of scalability, FastCGI is a neutral technical standard that fully supports processing programs written in any language (PHP, Java, Python ...)
2. Apache
Apache is the world's top Web server. According to a survey conducted by Netcraft (www. netsraft. co. uk), more than 50% of the world's Web servers are using Apache.
In April 1995, the earliest apache version 0.6.2 was released by Apache Group. apache Group is a non-profit organization that operates completely over the Internet. It determines what content should be included in the standard release of Apache Web servers. allow anyone to modify hidden errors, provide new features and port them to the new platform, and perform other work. when the new Code is submitted to the Apache Group, the Group reviews the specific content of the Code for testing. If satisfied, the code will be integrated into the main Apache release.
Apache features:
1) It 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) General Gateway Interface (CGI) supported)
5) supports virtual hosts.
6) supports HTTP authentication.
7) Integrate Perl.
Integrated Proxy Server
9) you can use a web browser to monitor the server status and customize logs.
10) the server can contain commands (SSI ).
11) supports Secure Socket Layer (SSL ).
12) tracking the user session process.
13) FastCGI support
14) Support for Java Servlets
3. nginx
Nginx is a lightweight HTTP server compiled by Russians. It is pronounced as "engine X" and is a high-performance HTTP and reverse proxy server, it is also an IMAP/POP3/SMTP proxy server. nginx is developed by the Russian site Igor Sysoev, which has the second access volume in Russia.
Nginx is written in event-driven mode, so it has excellent performance and is also a very efficient reverse proxy and load balancing. It has the performance matching Lighttpd, and there is no Lighttpd Memory leakage problem, and the mod_proxy of Lighttpd also has some problems and has not been updated for a long time. However, nginx does not support running in CGI Mode because it can reduce some program vulnerabilities. Therefore, you must use FastCGI to execute PHP programs.
As an HTTP server, nginx has the following basic features:
Process static files, index files, and automatic indexes; enable file descriptor buffering.
Non-Cache reverse proxy acceleration, simple load balancing and fault tolerance.
FastCGI, simple load balancing and fault tolerance.
Modular structure. Filters include gzipping, byte ranges, chunked responses, and SSI-filter. If FastCGI or another Proxy Server Processes multiple SSI in a single page, the processing can run in parallel without waiting for each other.
Nginx is designed for performance optimization. performance is the most important consideration, and efficiency is very important in implementation. It supports the kernel poll model and can withstand the high load test. The report shows that it supports up to 50,000 concurrent connections.
Nginx has high stability. When other HTTP servers encounter access peaks or maliciously initiate slow connections, the server may also consume physical memory and exchange frequently. In this case, the server can only be restarted if the response is lost. For example, once Apache has over 200 processes, the Web response speed is obviously very slow. Nginx adopts the phased Resource Allocation technology, making it very low in CPU and memory usage. Nginx officially said that it maintains 10,000 idle connections, which only occupies MB of memory. Therefore, DOS-like attacks are basically useless for nginx. In terms of stability, nginx is better than lighthttpd.
Nginx supports hot deployment. It is easy to start and can run almost without interruption, even if it runs for several months, it does not need to be restarted. You can also upgrade the software version without interrupting the service.
Ii. Comparison of the three web servers:

Server

Apache

Nginx

Lighttpd

Proxy

Very good

Very good

Average

Rewriter

Good

Very good

Average

Fcgi

Not good

Good

Very good

Hot deployment

Not Supported

Supported

Not Supported

System pressure comparison

Very large

Very small

Relatively small

Stability

Good

Very good

Not good

Security

Good

Average

Average

Technical Support

Very good

Very few

Average

Static File Processing

Average

Very good

Good

Vhosts Virtual Host

Supported

Not Supported

Supported

Reverse Proxy

Average

Very good

Average

Session sticky

Supported

Not Supported

Not Supported

Note: in relatively large websites, the server cost saved is undoubtedly objective. Some small websites often have few servers. If we use traditional Web servers such as Apache, we seem to be able to continue. However, Apache is prone to overload when dealing with traffic spikes (such as crawlers or Digg effects). In this case, nginx is the most suitable.
Recommended solution:
Apache backend server (mainly processing PHP and some functional requests such as Chinese URLs)
Nginx front-end server (using it to take advantage of a small amount of system resources to handle a large number of static page requests)
Lighttpd image server
In general, the improvement of nginx functions will make it the mainstream for Web servers in the future.
Iii. Performance Testing:
The response time for dynamic and static page requests and concurrency of the three software types will be tested respectively.
LStatic Page Sohu Homepage
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 Packet Loss

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

LDynamic page internal Community Homepage
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

LPhpinfoFunction page
Lighttpd

N/-C (AB parameter)

CPU %

Mem

Requestspersecond

Time taken for tests

100000/100

45

20

168.06

59.504

100000/200

47

22

140.64

71.103

100000/500

49

24

52.80

189.386

100000/1000

When the request reaches 4840, the test program will die.

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 packet loss

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

4. List of Web Server resources of various websites
Website name Operating System Web Server
1.Portal website:
Sohu Linux Apache 1.3.37
Sina Linux Apache 2.0.54
Thunder Linux nginx 0.6.31
163 Linux Apache 2.2.6
2.Search
Baidu unknown BWS 1.0
Google Linux GWs
Sogou FreeBSD Apache 2.2.4
Hao123 Linux Apache 2.2.4
4.Email
126 Linux Apache
Hotmail win2003 Microsoft-IIS 6.0
Sina mail F5 big-IP Apache 2.2.8
263 Linux Apache 2.2.6
5.Blog
Sina Blog Linux nginx 0.5.35
Sohu blog Linux nginx
Thunder blog Linux nginx 0.6.32
Tianya blogs 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

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.