lang/php

PHP Performence On Framework And Event-driven PHP (2) - with Apache2

C/H 2018. 6. 5. 08:30


/etc/hosts

127.0.0.1	dev.com
127.0.0.1	php.dev.com
127.0.0.1	reactphp.dev.com
127.0.0.1	ci.dev.com
127.0.0.1	phalcon.dev.com
127.0.0.1	workerman.dev.com
127.0.0.1	laravel.dev.com
127.0.0.1	bottle.dev.com

/etc/apache2/site-avaliable/test.conf

<VirtualHost *:80>
    ServerName php.dev.com
    DocumentRoot /home/username/Projects/php/pure

    ErrorLog ${APACHE_LOG_DIR}/php.phalcon.error.log
    CustomLog ${APACHE_LOG_DIR}/php.phalcon.access.log combined

    <Directory /home/username/Projects/php/pure>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
            <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f 
                RewriteCond %{REQUEST_FILENAME} !-d 
                RewriteRule ^(.*)$ index.php?/$1 [L] 
            </IfModule>
    </Directory>
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost *:80>
    ServerName phalcon.dev.com
    ServerAdmin uncaose@gmail.com
    DocumentRoot /home/username/Projects/php/phalcon/store

    ErrorLog ${APACHE_LOG_DIR}/php.phalcon.error.log
    CustomLog ${APACHE_LOG_DIR}/php.phalcon.access.log combined

    <Directory /home/username/Projects/php/phalcon/store>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
            <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f 
                RewriteCond %{REQUEST_FILENAME} !-d 
                RewriteRule ^(.*)$ index.php?/$1 [L] 
            </IfModule>
    </Directory>
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost *:80>
    ServerName ci.dev.com
    DocumentRoot /home/username/Projects/php/ci

    ErrorLog ${APACHE_LOG_DIR}/php.ci.error.log
    CustomLog ${APACHE_LOG_DIR}/php.ci.access.log combined

    <Directory /home/username/Projects/php/ci>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
            <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f 
                RewriteCond %{REQUEST_FILENAME} !-d 
                RewriteRule ^(.*)$ index.php?/$1 [L] 
            </IfModule>
    </Directory>
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost *:80>
    ServerName laravel.dev.com
    DocumentRoot /home/username/Projects/php/laravel/blog/public

    ErrorLog ${APACHE_LOG_DIR}/php.laravel.error.log
    CustomLog ${APACHE_LOG_DIR}/php.laravel.access.log combined

    <Directory /home/username/Projects/php/laravel/blog>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
            <IfModule mod_rewrite.c>
                RewriteEngine On
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f 
                RewriteCond %{REQUEST_FILENAME} !-d 
                RewriteRule ^(.*)$ index.php?/$1 [L] 
            </IfModule>
    </Directory>
    #Include conf-available/serve-cgi-bin.conf
</VirtualHost>

<VirtualHost *:80>
    ServerName reactphp.dev.com
    DocumentRoot /home/username/Projects/php/reactPhp
    ProxyPass "/"  "http://127.0.0.1:1338/"
    ProxyPassReverse "/"  "http://127.0.0.1:1338/"
</VirtualHost>

<VirtualHost *:80>
    ServerName workerman.dev.com
    DocumentRoot /home/username/Projects/php/workerman
    ProxyPass "/"  "http://127.0.0.1:1337/"
    ProxyPassReverse "/"  "http://127.0.0.1:1337/"
</VirtualHost>

ab Test

sudo a2enmod proxy
sudo a2enmod proxy_http

ab -n 10000 -c 10 -k http://php.dev.com/
Time per request:       1.392 [ms] (mean)
Time per request:       1.567 [ms] (mean)
Time per request:       1.564 [ms] (mean)
Time per request:       1.535 [ms] (mean)
Time per request:       1.547 [ms] (mean)
Time per request:       1.547 [ms] (mean)
Time per request:       1.287 [ms] (mean)
Time per request:       1.314 [ms] (mean)
Time per request:       1.536 [ms] (mean)
Time per request:       1.585 [ms] (mean)
Avg:                         1.4874 [ms] (mean)
ab -n 10000 -c 10 http://php.dev.com/
Time per request:       1.571 [ms] (mean)
Time per request:       1.733 [ms] (mean)
Time per request:       1.815 [ms] (mean)
Time per request:       1.848 [ms] (mean)
Time per request:       1.840 [ms] (mean)
Time per request:       1.809 [ms] (mean)
Time per request:       1.872 [ms] (mean)
Time per request:       1.812 [ms] (mean)
Time per request:       1.896 [ms] (mean)
Time per request:       1.872 [ms] (mean)
Avg:                         1.8068 [ms] (mean)


ab -n 10000 -c 10 -k http://phalcon.dev.com/
Time per request:       2.595 [ms] (mean)
Time per request:       2.571 [ms] (mean)
Time per request:       2.696 [ms] (mean)
Time per request:       3.301 [ms] (mean)
Time per request:       3.286 [ms] (mean)
Time per request:       2.936 [ms] (mean)
Time per request:       3.270 [ms] (mean)
Time per request:       3.252 [ms] (mean)
Time per request:       2.793 [ms] (mean)
Time per request:       2.742 [ms] (mean)
Avg:                         2.9442 [ms] (mean)
ab -n 10000 -c 10 http://phalcon.dev.com/
Time per request:       2.920 [ms] (mean)
Time per request:       3.184 [ms] (mean)
Time per request:       3.058 [ms] (mean)
Time per request:       3.505 [ms] (mean)
Time per request:       3.862 [ms] (mean)
Time per request:       3.540 [ms] (mean)
Time per request:       4.045 [ms] (mean)
Time per request:       3.880 [ms] (mean)
Time per request:       3.729 [ms] (mean)
Time per request:       3.624 [ms] (mean)
Avg:                         3.5347 [ms] (mean)


ab -n 10000 -c 10 -k http://laravel.dev.com/
chmod -R 777 blog/storage
Time per request:       40.254 [ms] (mean)
Time per request:       49.406 [ms] (mean)
Time per request:       66.833 [ms] (mean)
Time per request:       79.712 [ms] (mean)
Time per request:       93.811 [ms] (mean)
Time per request:       114.483 [ms] (mean)
Time per request:       143.249 [ms] (mean)
Time per request:       146.076 [ms] (mean)
Time per request:       175.181 [ms] (mean)
Time per request:       186.656 [ms] (mean)
Avg:                         109.5661 [ms] (mean)
# Last ab Test Load average 11.22, 10.26 8.33
ab -n 10000 -c 10 http://laravel.dev.com/
Time per request:       196.029 [ms] (mean)
Time per request:       204.228 [ms] (mean)
Time per request:       227.371 [ms] (mean)
Time per request:       239.029 [ms] (mean)
Time per request:       270.039 [ms] (mean)
Time per request:       201.333 [ms] (mean)
Time per request:       275.597 [ms] (mean)
Time per request:       232.846 [ms] (mean)
Time per request:       177.190 [ms] (mean)
Time per request:       195.289 [ms] (mean)
Avg:                         221.8951 [ms] (mean)


ab -n 10000 -c 10 -k http://ci.dev.com/
Time per request:       3.630 [ms] (mean)
Time per request:       3.919 [ms] (mean)
Time per request:       3.914 [ms] (mean)
Time per request:       4.071 [ms] (mean)
Time per request:       3.781 [ms] (mean)
Time per request:       3.971 [ms] (mean)
Time per request:       4.055 [ms] (mean)
Time per request:       4.345 [ms] (mean)
Time per request:       3.728 [ms] (mean)
Time per request:       3.878 [ms] (mean)
Avg:                         3.9292 [ms] (mean)
ab -n 10000 -c 10 http://ci.dev.com/
Time per request:       3.707 [ms] (mean)
Time per request:       4.329 [ms] (mean)
Time per request:       4.028 [ms] (mean)
Time per request:       4.371 [ms] (mean)
Time per request:       3.958 [ms] (mean)
Time per request:       4.042 [ms] (mean)
Time per request:       4.079 [ms] (mean)
Time per request:       4.013 [ms] (mean)
Time per request:       4.543 [ms] (mean)
Time per request:       4.002 [ms] (mean)
Avg:                         4.1072 [ms] (mean)

php server.php start
Server running at http://127.0.0.1:1338
ab -n 10000 -c 10 -k http://reactphp.dev.com/
Time per request:       2.390 [ms] (mean)
Time per request:       2.682 [ms] (mean)
Time per request:       2.704 [ms] (mean)
Time per request:       2.868 [ms] (mean)
Time per request:       2.668 [ms] (mean)
Time per request:       2.949 [ms] (mean)
Time per request:       2.671 [ms] (mean)
Time per request:       2.719 [ms] (mean)
Time per request:       2.772 [ms] (mean)
Time per request:       2.758 [ms] (mean)
Avg:                         2.7181 [ms] (mean)
ab -n 10000 -c 10 http://reactphp.dev.com/
Time per request:       1.418 [ms] (mean)
Time per request:       1.599 [ms] (mean)
Time per request:       1.218 [ms] (mean)
Time per request:       0.728 [ms] (mean)
Time per request:       0.677 [ms] (mean)
Time per request:       0.707 [ms] (mean)
Time per request:       0.714 [ms] (mean)
Time per request:       0.727 [ms] (mean)
Time per request:       0.707 [ms] (mean)
Time per request:       0.711 [ms] (mean)
Avg:                         0.9206 [ms] (mean)


php serve.php start
Workerman[serve.php] start in DEBUG mode
----------------------- WORKERMAN -----------------------------
Workerman version:3.5.9          PHP version:7.2.5-0ubuntu0.18.04.1
------------------------ WORKERS -------------------------------
user          worker        listen              processes status
uncaose       none          tcp://0.0.0.0:1337   1         [OK] 
----------------------------------------------------------------
ab -n 10000 -c 10 -k http://workerman.dev.com/
Time per request:       0.435 [ms] (mean)
Time per request:       0.529 [ms] (mean)
Time per request:       0.500 [ms] (mean)
Time per request:       0.525 [ms] (mean)
Time per request:       0.626 [ms] (mean)
Time per request:       0.426 [ms] (mean)
Time per request:       0.483 [ms] (mean)
Time per request:       0.419 [ms] (mean)
Time per request:       0.444 [ms] (mean)
Time per request:       0.430 [ms] (mean)
Avg:                         0.4817 [ms] (mean)
ab -n 10000 -c 10 http://workerman.dev.com/
Time per request:       0.676 [ms] (mean)
Time per request:       0.741 [ms] (mean)
Time per request:       0.738 [ms] (mean)
Time per request:       0.768 [ms] (mean)
Time per request:       0.865 [ms] (mean)
Time per request:       0.782 [ms] (mean)
Time per request:       0.790 [ms] (mean)
Time per request:       0.815 [ms] (mean)
Time per request:       0.809 [ms] (mean)
Time per request:       0.826 [ms] (mean)
Avg:                         0.781 [ms] (mean)


Apache2 Server

  1.      0.4817 : ab -n 10000 -c 10 -k http://workerman.dev.com/
  2.      0.781x : ab -n 10000 -c 10 http://workerman.dev.com/
  3.      0.9206 : ab -n 10000 -c 10 http://reactphp.dev.com/
  4.      1.4874 : ab -n 10000 -c 10 -k http://php.dev.com/
  5.      1.8068 : ab -n 10000 -c 10 http://php.dev.com/
  6.      2.7181 : ab -n 10000 -c 10 -k http://reactphp.dev.com/
  7.      2.9442 : ab -n 10000 -c 10 -k http://phalcon.dev.com/
  8.      3.5347 : ab -n 10000 -c 10 http://phalcon.dev.com/
  9.      3.9292 : ab -n 10000 -c 10 -k http://ci.dev.com/
  10.      4.1072 : ab -n 10000 -c 10 http://ci.dev.com/
  11. 109.5661 : ab -n 10000 -c 10 -k http://laravel.dev.com/
  12. 221.8951 : ab -n 10000 -c 10 http://laravel.dev.com/


php -S Server

  1.   0.1570: Workerman 3.5.9
  2.   1.739x: PHP 7.2.5
  3.   1.9430: ReactPHP
  4.   4.0330: Phalcon 3.3.2
  5.   6.2870: CodeIginter 3.1.8
  6. 85.444x: Laravel 5.6.23


반응형