小林博客升級到PHP7.2,附PHP7.1與7.2對比
小林博客升級到PHP7.2,附PHP7.1與7.2對比在去年就已經(jīng)使用PHP7版本了,那時就說PHP7比老版本快了很多很多,在今年,又分別出了7.1和7.2版本,從?WordPress 4.9.3 開始,該版本修復(fù)了 4.9 以來的34個問題。包括外觀定制器更改、小工具、可視編輯
小林博客升級到PHP7.2,附PHP7.1與7.2對比在去年就已經(jīng)使用PHP7版本了,那時就說PHP7比老版本快了很多很多,在今年,又分別出了7.1和7.2版本,從?WordPress 4.9.3 開始,該版本修復(fù)了 4.9 以來的34個問題。包括外觀定制器更改、小工具、可視編輯
在去年就已經(jīng)使用PHP7版本了,那時就說PHP7比老版本快了很多很多,在今年,又分別出了7.1和7.2版本,從?WordPress 4.9.3 開始,該版本修復(fù)了 4.9 以來的34個問題。包括外觀定制器更改、小工具、可視編輯器和php 7.2兼容性的修復(fù)。在做了一些對比后,最終決定將博客環(huán)境升級到PHP7.2版本。
匯總 | bench.php | bench.php +?opcache | micro_bench.php | micro_bench.php + opcache |
---|---|---|---|---|
PHP7.1 | 1.3859 | 0.8133 | 5.6365 | 4.3600 |
PHP7.2 | 1.4514 | 0.7867 | 5.5840 | 3.7234 |
# php7.1 Concurrency Level: 10 Time taken for tests: 8.696 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 5215300 bytes HTML transferred: 5189300 bytes Requests per second: 11.50 [#/sec] (mean) Time per request: 869.637 [ms] (mean) Time per request: 86.964 [ms] (mean, across all concurrent requests) Transfer rate: 585.65 [Kbytes/sec] received
# php7.2 Concurrency Level: 10 Time taken for tests: 8.528 seconds Complete requests: 100 Failed requests: 0 Write errors: 0 Total transferred: 5215500 bytes HTML transferred: 5189300 bytes Requests per second: 11.73 [#/sec] (mean) Time per request: 852.793 [ms] (mean) Time per request: 85.279 [ms] (mean, across all concurrent requests) Transfer rate: 597.24 [Kbytes/sec] received
可以看到在未開啟opcache的情況下,性能非常糟糕,10個并發(fā)的情況下,每個請求的響應(yīng)時間已經(jīng)非常長了,沒有必要繼續(xù)增加并發(fā)數(shù)了。
匯總 | 7.1 Requests per second (每秒) | 7.1 Time per request (ms) | 7.2 Requests per second (每秒) | 7.2 Time per request (ms) |
---|---|---|---|---|
c10 n100 | 60.63 | 164.939 | 70.05 | 142.762 |
c20 n200 | 66.27 | 301.803 | 70.74 | 282.719 |
c30 n300 | 66.50 | 451.121 | 70.89 | 423.2 |
c40 n400 | 67.95 | 588.683 | 70.6 | 566.608 |
在開啟opcache 之后,相對之前未開啟的情況性能簡直天壤之別。相比之下php7.2在wordpress壓測上,QPS 穩(wěn)定在70+ 相對php7.1 增加不少。
測試結(jié)果和配置參數(shù)以及服務(wù)器配置有關(guān),僅供對比php7.1與7.2的性能。
版權(quán)所有:深圳市網(wǎng)商在線科技有限公司