Performance test comparison between Apache and Nginx in CentOS
After apache2.4.1 is released, it is said that the performance target is directly directed to nginx. Therefore, you have compiled and installed two versions for stress testing on static pages.
The test server has two CPUs of 2 GB memory.
Compilation options:
Apache:
./Configure-prefix =/usr/local/apache-enable-proxy-http-enable-proxy-fcgi-enable-proxy-Enable-proxy-connect-enable-proxy-ftp-with-apr =/usr/local/apr-with-apr-util =/usr/local/apr-util/
Nginx:
./Configure-prefix =/usr/local/nginx
Peer server AB Pressure on the same Static Page
[Root @ localhost ~] # Curl http: // 192.168.2.129/index.html
Test for apache 2.4.
Data:
Apache:
[Root @ localhost ~] # AB-n 1000000-c 100 http: // 192.168.2.129/index.html
This is apachetings, Version 2.0.40-dev <$ Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.2.129 (be patient)
Completed100000 requests
Completed200000 requests
Completed300000 requests
Completed400000 requests
Completed500000 requests
Completed600000 requests
Completed700000 requests
Completed800000 requests
Completed900000 requests
Finished 1000000 requests
Server Software:Apache/2.4.1
Server Hostname:192.168.2.129
Server Port:80
Document Path:/Index.html
Document Length:20 bytes
Concurrency Level:100
Time taken for tests:132.517663 seconds
Complete requests:1000000
Failed requests:0
Write errors:0
Total transferred:263000000 bytes
HTML transferred:20000000 bytes
Requests per second:7546.16 [#/sec] (mean)
Time per request:13.252 [MS] (mean)
Time per request:0.133 [MS] (mean, internal SS all concurrent requests)
Transfer rate:1938.12 [Kbytes/sec] committed ed
Connection Times (MS)
MinMean [+/-sd] medianMax
Connect:0159.303001
Processing:01116.85687
Waiting:0711.12630
Total:01261.753067
Percentage of the requests served within a certain time (MS)
50%5
66%14
75%19
80%23
90%32
95%40
98%49
99%57
100%3067 (longest request)
Nginx:
[Root @ localhost ~] # AB-n 1000000-c 100 http: // 192.168.2.129/index.html
This is apachetings, Version 2.0.40-dev <$ Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.2.129 (be patient)
Completed100000 requests
Completed200000 requests
Completed300000 requests
Completed400000 requests
Completed500000 requests
Completed600000 requests
Completed700000 requests
Completed800000 requests
Completed900000 requests
Finished 1000000 requests
Server Software:Nginx/1.0.12
Server Hostname:192.168.2.129
Server Port:80
Document Path:/Index.html
Document Length:20 bytes
Concurrency Level:100
Time taken for tests:110.121829 seconds
Complete requests:1000000
Failed requests:0
Write errors:0
Total transferred:230000230 bytes
HTML transferred:20000020 bytes
Requests per second:9080.85 [#/sec] (mean)
Time per request:11.012 [MS] (mean)
Time per request:0.110 [MS] (mean, internal SS all concurrent requests)
Transfer rate:2039.64 [Kbytes/sec] committed ed
Connection Times (MS)
MinMean [+/-sd] medianMax
Connect:0159.903005
Processing:097.99649
Waiting:086.59647
Total:11060.493016
Percentage of the requests served within a certain time (MS)
50%9
66%10
75%11
80%11
90%11
95%11
98%11
99%12
100%3016 (longest request)
Apache's Requests per second reaches 7546.16 [#/sec], while nginx outperforms 9080.85 [#/sec].
In the process of running apache, the server load once reached load average: 83.66 in 1 minute, while nginx continued to be around 1.5. httpd is still not comparable to nginx.