openresty1.13 与 nginx+php7.0-fpm 压测对比,openresty1.13nginx
openresty1.13 与 nginx+php7.0-fpm 压测对比,openresty1.13nginx
为了验证下 openresty 官网所说的比 nginx+php-fpm 的吞吐量要高,因此做了以下测试,本次测试服务器硬件配置如下:
Dell latitude 3330
CPU: 4 core Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz
MEM: 8GB
本次测试两种架构下,服务器都发送 "Hello,world!" 这一字符串。
1. 100并发,50k请求
以下为 openresty 的压测结果
➜ ~ ab -c 100 -n 50000 -q http://192.168.8.156:8090/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.8.156 (be patient).....done
Server Software: openresty/1.13.6.2
Server Hostname: 192.168.8.156
Server Port: 8090
Document Path: /
Document Length: 20 bytes
Concurrency Level: 100
Time taken for tests: 2.743 seconds
Complete requests: 50000
Failed requests: 0
Total transferred: 8400000 bytes
HTML transferred: 1000000 bytes
Requests per second: 18226.60 [#/sec] (mean)
Time per request: 5.486 [ms] (mean)
Time per request: 0.055 [ms] (mean, across all concurrent requests)
Transfer rate: 2990.30 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 2 0.6 2 5
Processing: 1 3 0.7 3 10
Waiting: 1 2 0.6 2 10
Total: 4 5 0.5 5 15
Percentage of the requests served within a certain time (ms)
50% 5
66% 6
75% 6
80% 6
90% 6
95% 6
98% 6
99% 7
100% 15 (longest request)
以下为 nginx+php7.0-fpm 的压测结果
➜ ~ ab -c 100 -n 50000 -q http://192.168.8.156:8080/test.php
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.8.156 (be patient).....done
Server Software: nginx/1.15.3
Server Hostname: 192.168.8.156
Server Port: 8080
Document Path: /test.php
Document Length: 13 bytes
Concurrency Level: 100
Time taken for tests: 3.380 seconds
Complete requests: 50000
Failed requests: 0
Total transferred: 7500000 bytes
HTML transferred: 650000 bytes
Requests per second: 14791.25 [#/sec] (mean)
Time per request: 6.761 [ms] (mean)
Time per request: 0.068 [ms] (mean, across all concurrent requests)
Transfer rate: 2166.69 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 0.6 0 5
Processing: 2 6 1.2 6 14
Waiting: 1 6 1.3 6 14
Total: 4 7 1.1 6 15
WARNING: The median and mean for the initial connection time are not within a normal deviation
These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
50% 6
66% 7
75% 7
80% 8
90% 8
95% 9
98% 10
99% 11
100% 15 (longest request)
2. 1k并发,50k请求
以下为 openresty 的压测结果
➜ ~ ab -c 1000 -n 50000 -q http://192.168.8.156:8090/
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.8.156 (be patient).....done
Server Software: openresty/1.13.6.2
Server Hostname: 192.168.8.156
Server Port: 8090
Document Path: /
Document Length: 20 bytes
Concurrency Level: 1000
Time taken for tests: 3.445 seconds
Complete requests: 50000
Failed requests: 0
Total transferred: 8400000 bytes
HTML transferred: 1000000 bytes
Requests per second: 14514.61 [#/sec] (mean)
Time per request: 68.896 [ms] (mean)
Time per request: 0.069 [ms] (mean, across all concurrent requests)
Transfer rate: 2381.30 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 10 24 22.2 23 1030
Processing: 7 35 30.5 33 772
Waiting: 5 27 30.7 25 771
Total: 27 58 37.1 57 1057
Percentage of the requests served within a certain time (ms)
50% 57
66% 60
75% 61
80% 62
90% 63
95% 64
98% 67
99% 75
100% 1057 (longest request)
以下为 nginx+php7.0-fpm 的压测结果
➜ ~ ab -c 1000 -n 50000 -q http://192.168.8.156:8080/test.php
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 192.168.8.156 (be patient).....done
Server Software: nginx/1.15.3
Server Hostname: 192.168.8.156
Server Port: 8080
Document Path: /test.php
Document Length: 13 bytes
Concurrency Level: 1000
Time taken for tests: 5.165 seconds
Complete requests: 50000
Failed requests: 14407
(Connect: 0, Receive: 0, Length: 14407, Exceptions: 0)
Non-2xx responses: 14407
Total transferred: 14962826 bytes
HTML transferred: 7579767 bytes
Requests per second: 9680.80 [#/sec] (mean)
Time per request: 103.297 [ms] (mean)
Time per request: 0.103 [ms] (mean, across all concurrent requests)
Transfer rate: 2829.14 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 7 28 114.9 14 1043
Processing: 7 34 64.3 23 2021
Waiting: 7 31 64.2 20 2021
Total: 14 62 133.9 37 3028
Percentage of the requests served within a certain time (ms)
50% 37
66% 42
75% 46
80% 48
90% 57
95% 72
98% 387
99% 1034
100% 3028 (longest request)
3. 总结
并发情况 | 吞吐量 | 平均完成时间 | 90%完成时间 |
c100 n50k | 18226.6/14791.25 | 5/7 | 6/8 |
c1k n50k | 14514.61/9680.80 | 58/62 | 63/57 |
以上数据对比格式为: openresty/nginx+php7.0-fpm
从上面对比情况可以看出,openresty 在并发情况下吞吐量的确要比 nginx+php7.0-fpm 高。
评论暂时关闭