php8.0 及php7.2效能基準簡單測試

authcontroller發表於2020-11-27

php7.2.34 、php8.0-rc

使用ab 測試工具

 併發20 請求100
 ab -n 100 -c 20 -l http://local.test.com/performance.php

版本-7.2.34

Server Software:        nginx/1.18.0
Server Hostname:        local.test.com
Server Port:            80

Document Path:          /performance.php
Document Length:        Variable

Concurrency Level:      20
Time taken for tests:   0.018 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      18300 bytes
HTML transferred:       3700 bytes
Requests per second:    5450.78 [#/sec] (mean)
Time per request:       3.669 [ms] (mean)
Time per request:       0.183 [ms] (mean, across all concurrent requests)
Transfer rate:          974.11 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:     1    3   0.9      2       5
Waiting:        1    3   0.8      2       5
Total:          2    3   0.9      3       5
WARNING: The median and mean for the processing time are not within a normal deviation
        These results are probably not that reliable.
WARNING: The median and mean for the waiting 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%      3
  66%      3
  75%      4
  80%      4
  90%      4
  95%      4
  98%      5
  99%      5
 100%      5 (longest request)

版本-8.0-rc

Server Software:        nginx/1.18.0
Server Hostname:        local.test.com
Server Port:            80

Document Path:          /performance.php
Document Length:        Variable

Concurrency Level:      20
Time taken for tests:   0.014 seconds
Complete requests:      100
Failed requests:        0
Total transferred:      15400 bytes
HTML transferred:       800 bytes
Requests per second:    7244.28 [#/sec] (mean)
Time per request:       2.761 [ms] (mean)
Time per request:       0.138 [ms] (mean, across all concurrent requests)
Transfer rate:          1089.47 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.3      0       1
Processing:     1    2   0.4      2       3
Waiting:        0    2   0.5      2       3
Total:          1    2   0.4      2       4

Percentage of the requests served within a certain time (ms)
  50%      2
  66%      2
  75%      3
  80%      3
  90%      3
  95%      3
  98%      4
  99%      4
 100%      4 (longest request)

簡單測試發現,正如官方所說,新版本在IO方面效能提升很小,更多效能體現在密集型運算方面

本作品採用《CC 協議》,轉載必須註明作者和本文連結

相關文章