The configuration directives are as follows:
[Opcache]
zend_extension=opcache.so
opcache.enable_cli=1
shared memory size, which is adjustable according to your needs
opcache.memory_consumption=256 The
memory size of the interned string can also be adjusted
opcache.interned_strings_buffer=8 the
maximum number of files cached
opcache.max_accelerated _files=4000
60s Check for file update
opcache.revalidate_freq=60
, turn on fast shutdown, open this when PHP Request shutdown will be able to collect memory speed will increase
opcache.fast_shutdown=1
without saving the file/function comment
opcache.save_comments=0
Actual Performance comparison:
Here is the data that does not open Opcache in the actual test:
[Root@localhost ~]# ab-n 10000-c "Http://112.126.69.14/main.php?a=Role&m=createRole" This is Apachebench, Versi On 2.3 < $Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd., http://www.zeustech.net/Licensed to Th E Apache Software Foundation, http://www.apache.org/Benchmarking 112.126.69.14 (Be patient) Completed 1000 requests Comp Leted Requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Comple Ted 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=rol E&m=createrole Document length:2 bytes Concurrency level:200 time taken for tests:26.061 seconds Complete re quests: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/request: 521.216 [MS] (mean) time/request:2.606 [MS] (mean, across all concurrent requests) Transfer rate:64.21 [Kb YTES/SEC] received Connection times (ms) min MEAN[+/-SD] Median max Connect:2 3 3.2 2 processing:1 7 461 905.0 219 16496 waiting:17 461 904.9 219 16496 total:21 464 905.0 222 16502 Percentage of the Reques TS served within a certain time (ms) 50% 222 66% 271 75% 369 80% 412 90% 805 95% 1248 98% 2597 99% 3489 1
00% 16502 (Longest request)
Data after opening:
[Root@localhost ~]# ab-n 10000-c "Http://112.126.69.14/main.php?a=Role&m=createRole" This is Apachebench, Versi On 2.3 < $Revision: 655654 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd., http://www.zeustech.net/Licensed to Th E Apache Software Foundation, http://www.apache.org/Benchmarking 112.126.69.14 (Be patient) Completed 1000 requests Comp Leted Requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Comple Ted 7000 Requests Completed 8000 requests Completed 9000 requests Completed 10000 requests finished 10000 requests Serve R software:openresty/1.7.2.1 Server hostname:112.126.69.14 server port:80 Document Path:/main.php?a=ro Le&m=createrole Document length:2 bytes Concurrency level:200 time taken for tests:14.237 seconds Complete R equests:10000 Failed requests:0 Write errors:0 total transferred:1711710 bytes HTML transferred:20020 Bytes Requests per second:702.40 [#/sec] (mean) time/request:284.739 [MS] (mean) time/request:1.424 [MS] (mean, across all CONCU
Rrent requests) Transfer rate:117.41 [kbytes/sec] received Connection times (ms) min MEAN[+/-SD] Median max Connect:2 272.6 2 3005 processing:4 176 666.4 6 9026 waiting:4 163 642.8 6 9026 Total:6 242 7 45.7 9 10028 Percentage of the requests served within a certain time (ms) 50% 9 66% 14 75% 99 80% 122 90%
1006 1476 98% 2853 99% 3543 100% 10028 (longest request)
The above is the entire content of this article, I hope you can enjoy.