admin@80vps.com
联系我们
QQ:1668121212
CN
Cn
En
邮件订阅
服务条款
优惠促销
会员中心
Toggle navigation
站群服务器
香港站群
美国站群
日本站群
韩国站群
新加坡站群
国内云主机
景安多线
四川双线云主机
上海电信
华为云
香港服务器
香港Cera高防
香港PowerLine
香港Pangnet
香港BGP大带宽
沙田大带宽
香港九龙
香港大浦
亚太服务器
越南服务器
韩国优化
韩国首尔
日本CIA
日本CN2
日本精品
新加坡
欧美及高防
洛杉矶MC
凤凰城IF
洛杉矶Cera高防
洛杉矶SK高防
VPS主机
亚太VPS列表
新加坡SG
日本CTG
香港CTG
韩国BGP
香港CI
欧美VPS列表
美国Cera
美国MC
帮助中心
账户管理
用户注册
登录验证
购买结算
充值汇款
新购续费
退款处理
VPS购买及使用
常用下载
VPS云服务器介绍
用户操作指南
Linux操作指南
Windows操作指南
产品介绍
常用下载
PHP源码
ASP源码
在线工具
推广
本月特价
CentOS下Apache与Nginx性能测试对比
浏览次数:2794 关键词 (
性能测试
CentOS
Apache
Nginx
)
apache2.4.1放出后据说性能目标直指nginx,所以自己编译安装了两个版本进行静态页的压力测试。
测试服务器为虚拟机 2颗CPU 2G内存。
编译选项:
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
相邻机ab压同一静态页
[root@localhost ~]# curl http://192.168.2.129/index.html
test for apache 2.4
数据:
apache:
[root@localhost ~]# ab -n 1000000 -c 100 http://192.168.2.129/index.html
This is ApacheBench, 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)
Completed 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
Completed 500000 requests
Completed 600000 requests
Completed 700000 requests
Completed 800000 requests
Completed 900000 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, across all concurrent requests)
Transfer rate:
1938.12 [Kbytes/sec] received
Connection Times (ms)
min
mean[+/-sd] median
max
Connect:
0
1
59.3
0
3001
Processing:
0
11
16.8
5
687
Waiting:
0
7
11.1
2
630
Total:
0
12
61.7
5
3067
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 ApacheBench, 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)
Completed 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
Completed 500000 requests
Completed 600000 requests
Completed 700000 requests
Completed 800000 requests
Completed 900000 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, across all concurrent requests)
Transfer rate:
2039.64 [Kbytes/sec] received
Connection Times (ms)
min
mean[+/-sd] median
max
Connect:
0
1
59.9
0
3005
Processing:
0
9
7.9
9
649
Waiting:
0
8
6.5
9
647
Total:
1
10
60.4
9
3016
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的Requests per second达到了7546.16 [#/sec] 而nginx则更胜一筹有9080.85 [#/sec]
其中在apache跑的过程中服务器的负载load 1分钟一度达到了load average: 83.66左右,而nginx则持续在1.5左右,httpd仍然不能算是能和nginx媲美