Centos:7
PHP版本:7.2
ab压测结果
未开启opcache
Server Software: nginx
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.php
Document Length: 34561 bytes
Concurrency Level: 100
Time taken for tests: 277.214 seconds
Complete requests: 10000
Failed requests: 6
(Connect: 0, Receive: 0, Length: 6, Exceptions: 0)
Write errors: 0
Non-2xx responses: 2
Total transferred: 348573774 bytes
HTML transferred: 345434112 bytes
Requests per second: 36.07 [#/sec] (mean)
Time per request: 2772.143 [ms] (mean)
Time per request: 27.721 [ms] (mean, across all concurrent requests)
Transfer rate: 1227.95 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 3
Processing: 85 2766 289.2 2770 4190
Waiting: 80 2766 289.2 2770 4190
Total: 85 2766 289.1 2770 4190
Percentage of the requests served within a certain time (ms)
50% 2770
66% 2863
75% 2920
80% 2959
90% 3074
95% 3190
98% 3356
99% 3466
100% 4190 (longest request)
开启后(默认参数)
Server Software: nginx
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.php
Document Length: 34561 bytes
Concurrency Level: 100
Time taken for tests: 210.559 seconds
Complete requests: 10000
Failed requests: 14
(Connect: 0, Receive: 0, Length: 14, Exceptions: 0)
Write errors: 0
Non-2xx responses: 2
Total transferred: 348484354 bytes
HTML transferred: 345344692 bytes
Requests per second: 47.49 [#/sec] (mean)
Time per request: 2105.585 [ms] (mean)
Time per request: 21.056 [ms] (mean, across all concurrent requests)
Transfer rate: 1616.26 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 6
Processing: 69 2101 262.1 2090 3688
Waiting: 65 2101 262.1 2090 3688
Total: 69 2101 262.0 2090 3688
Percentage of the requests served within a certain time (ms)
50% 2090
66% 2165
75% 2214
80% 2249
90% 2377
95% 2535
98% 2732
99% 2861
100% 3688 (longest request)
配置参数
linux:
sudo sysctl vm.nr_hugepages=512
php.ini:
opcache.huge_code_pages=1
opcache.file_cache=/tmp
开启后(配置参数)
Server Software: nginx
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /index.php
Document Length: 34561 bytes
Concurrency Level: 100
Time taken for tests: 208.019 seconds
Complete requests: 10000
Failed requests: 13
(Connect: 0, Receive: 0, Length: 13, Exceptions: 0)
Write errors: 0
Non-2xx responses: 2
Total transferred: 348553029 bytes
HTML transferred: 345413367 bytes
Requests per second: 48.07 [#/sec] (mean)
Time per request: 2080.191 [ms] (mean)
Time per request: 20.802 [ms] (mean, across all concurrent requests)
Transfer rate: 1636.31 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.2 0 3
Processing: 64 2076 212.5 2066 3521
Waiting: 60 2076 212.5 2066 3521
Total: 64 2076 212.4 2066 3521
Percentage of the requests served within a certain time (ms)
50% 2066
66% 2131
75% 2173
80% 2202
90% 2299
95% 2410
98% 2568
99% 2680
100% 3521 (longest request)