lang/php

PHP Performence On Framework And Event-driven PHP (1)

C/H 2018. 6. 1. 18:04

PHP

php -v
PHP 7.2.5-0ubuntu0.18.04.1 (cli) (built: May  9 2018 17:21:02) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-0ubuntu0.18.04.1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans

Result

  1. Workerman 3.5.9 : 0.157 [ms] (mean) -- 왜 이럴까? ㅡ.ㅡa
  2. Ruby: 0.470 [ms] (mean)
  3. Node.js: 0.766 [ms] (mean)
  4. Python: 1.554 [ms] (mean)
  5. PHP 7.2.5 : 1.739 [ms] (mean)
  6. ReactPHP : 1.943 [ms] (mean)
  7. Phalcon 3.3.2 : 4.033 [ms] (mean)
  8. CodeIginter 3.1.8 : 6.287 [ms] (mean)
  9. Slim 3.10.0 : 38.707 [ms] (mean)
  10. Laravel5.6.23 : 85.444 [ms] (mean)

P.S : 결과는 임의의 횟수로 진행된 결과중 가장 빠른 결과치만 취했다, 대체로 동일한 결과치가 분포되었다.
- Linux 4.15.0-22-generic #24-Ubuntu SMP
- Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz
- MemTotal: 8058444 kB

PHP pure code

<?php
echo "Hello World";
php -S 127.0.0.1:1337

#other sell
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
...
Concurrency Level:      10
Time taken for tests:   1.739 seconds
Complete requests:      10000
Failed requests:        0
Keep-Alive requests:    0
Total transferred:      1920000 bytes
HTML transferred:       110000 bytes
Requests per second:    5750.40 [#/sec] (mean)
Time per request:       1.739 [ms] (mean)
Time per request:       0.174 [ms] (mean, across all concurrent requests)
Transfer rate:          1078.20 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     1    2   0.6      2      10
Waiting:        1    2   0.6      2      10
Total:          1    2   0.6      2      11

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

Codeigniter3

php -S localhost:1337

# other shell
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
...
Time per request:       6.287 [ms] (mean)

Laravel

php blog/artisan serve

# ohter sell, -k(kepp Alive) 옵션을 사용하면 더 오래 걸리는 현상이 있음.
ab -n 10000 -c 10 http://127.0.0.1:8000/
...
Time per request:       85.444 [ms] (mean)

ReactPHP

php server.php
Server running at http://127.0.0.1:1337

# other shell
ab -n 10000 -c 10 http://127.0.0.1:1337/
...
Time per request:       1.943 [ms] (mean)

Workerman

php serve.php start -d

#other shell, -k(keep Alive) 옵션이 없으면 테스가 안됨.
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
..
Time per request:       0.157 [ms] (mean)

Phalcon PHP Phalcon Installation

php -S 127.0.0.1:1337 public/index.php 

# other shell
Time per request:       4.033 [ms] (mean)

Slim PHP FrameWork

php -S localhost:8080 -t public public/index.php

#other sell
ab -n 10000 -c 10 -k http://localhost:8080/
.....
Time per request:       38.707 [ms] (mean)

Python

python serve.py

# ohter terminal
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
.....
Time per request:       1.554 [ms] (mean)

Python bottle

python app.py
Bottle v0.12.13 server starting up (using WSGIRefServer())...
...

# other sell
ab -n10000 -c10 -g out.data -k http://127.0.0.1:1337/
...
Time per request:       2.736 [ms] (mean)

Node.js

node app.js

# other terminal
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
.....
Time per request:       0.766 [ms] (mean)

Node.js Express

node app2.js

# other terminal
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
.....
Time per request:       0.879 [ms] (mean)

Ruby

ruby server.rb

# other terminal
ab -n 10000 -c 10 -k http://127.0.0.1:1337/
.....
Time per request:       0.470 [ms] (mean)


반응형