首页 > 代码库 > apache nginx 性能简单对比测试
apache nginx 性能简单对比测试
VPC
32 cpus,8G ram,SSD
linux 环境是centos 7
apache 2.4 yum安装base库
php 5.4 yum安装base库
php-fpm 5.4 yum安装base库
nginx 1.10 yum安装epel库
windows 环境是 windows server 2012R2
apache 2.4
php 5.5
测试phpinfo,
<?php phpinfo();?>
ab压力测试,32线程,共1024000个链接,性能对比如下
linux apache php
Concurrency Level: 32
Time taken for tests: 122.010 seconds
Complete requests: 1024000
Failed requests: 102711
(Connect: 0, Receive: 0, Length: 102711, Exceptions: 0)
Write errors: 0
Total transferred: 42976140870 bytes
HTML transferred: 42788748870 bytes
Requests per second: 8392.73 [#/sec] (mean)
Time per request: 3.813 [ms] (mean)
Time per request: 0.119 [ms] (mean, across all concurrent requests)
Transfer rate: 343978.17 [Kbytes/sec] received
windows apache php
Concurrency Level: 32
Time taken for tests: 280.478 seconds
Complete requests: 1024000
Failed requests: 105718
(Connect: 0, Receive: 0, Length: 105718, Exceptions: 0)
Write errors: 0
Total transferred: 85580685230 bytes
HTML transferred: 85461901230 bytes
Requests per second: 3650.91 [#/sec] (mean)
Time per request: 8.765 [ms] (mean)
Time per request: 0.274 [ms] (mean, across all concurrent requests)
Transfer rate: 297973.35 [Kbytes/sec] received
linux nginx php-fpm
Concurrency Level: 32
Time taken for tests: 130.657 seconds
Complete requests: 1024000
Failed requests: 104256
(Connect: 0, Receive: 0, Length: 104256, Exceptions: 0)
Write errors: 0
Total transferred: 38909836092 bytes
HTML transferred: 38758284092 bytes
Requests per second: 7837.32 [#/sec] (mean)
Time per request: 4.083 [ms] (mean)
Time per request: 0.128 [ms] (mean, across all concurrent requests)
Transfer rate: 290821.98 [Kbytes/sec] received
在都是默认配置的情况下,linux性能确实好很多,apache能跑到每秒8392次响应,但nginx没有想象中性能高,只有每秒7837次响应,可能是没有优化好。windows apache 垫底,只有每秒3650次响应。
本文出自 “专注打孔100年” 博客,请务必保留此出处http://titandeng.blog.51cto.com/823817/1904055
apache nginx 性能简单对比测试