配置指令如下:
实际性能对比:
下面是实际测试中没有开启opcache的数据:
Benchmarking 112.126.69.14 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests
Server Software: openresty/1.7.2.1
Server Hostname: 112.126.69.14
Server Port: 80
Document Path: /main.PHP?a=Role&m=createRole
Document Length: 2 bytes
Concurrency Level: 200
Time taken for tests: 26.061 seconds
Complete requests: 10000
Failed requests: 20
(Connect: 0,Receive: 0,Length: 20,Exceptions: 0)
Write errors: 0
Non-2xx responses: 20
Total transferred: 1713580 bytes
HTML transferred: 23520 bytes
Requests per second: 383.72 [#/sec] (mean)
Time per request: 521.216 [ms] (mean)
Time per request: 2.606 [ms] (mean,across all concurrent requests)
Transfer rate: 64.21 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 2 3 3.2 2 60
Processing: 17 461 905.0 219 16496
Waiting: 17 461 904.9 219 16496
Total: 21 464 905.0 222 16502
Percentage of the requests served within a certain time (ms)
50% 222
66% 271
75% 369
80% 412
90% 805
95% 1248
98% 2597
99% 3489
100% 16502 (longest request)
开启之后的数据:
Benchmarking 112.126.69.14 (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Completed 10000 requests
Finished 10000 requests
Server Software: openresty/1.7.2.1
Server Hostname: 112.126.69.14
Server Port: 80
Document Path: /main.PHP?a=Role&m=createRole
Document Length: 2 bytes
Concurrency Level: 200
Time taken for tests: 14.237 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1711710 bytes
HTML transferred: 20020 bytes
Requests per second: 702.40 [#/sec] (mean)
Time per request: 284.739 [ms] (mean)
Time per request: 1.424 [ms] (mean,across all concurrent requests)
Transfer rate: 117.41 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 2 66 272.6 2 3005
Processing: 4 176 666.4 6 9026
Waiting: 4 163 642.8 6 9026
Total: 6 242 745.7 9 10028
Percentage of the requests served within a certain time (ms)
50% 9
66% 14
75% 99
80% 122
90% 1006
95% 1476
98% 2853
99% 3543
100% 10028 (longest request)
以上所述就是本文的全部内容,希望大家能够喜欢。
原文链接:https://www.f2er.com/php/22042.html