「The stunningly fast micro-framework by Laravel.」と公言しているLumenですが、
Laravelとどの程度の差があるかHello Worldで計測してみました。
テスト環境
Intel Core i7-4790K メモリー 16GB Ubuntu 15.10 PHP 5.6.11 nginx/1.9.3
- 特別なチューニングはしていません
- nginxとphp-fpmの設定もインストールした時のデフォルトのままです。
- LaravelとLumenはcomposerインストールした状態です
- どちらもroute.phpで文字列"Hello World!"を返すように修正しました。
- abコマンドで計測しました
結果
Laravel 5.2 928.19 req/sec Lumen 5.2 5589.13 req/sec予想以上に差が出てしまいました。約6倍
機能の数が違うので、検討すべきことは多いですが、LumenはAPIサーバとかに向いているかも。オーバーヘッドの少ないWAFですね。
なかなか悩ましい結果となりました。
以上、簡易的なベンチマークでした。
Laravel 5.2
ab -c 100 -n 10000 http://laravel.local/ This is ApacheBench, Version 2.3 <$Revision: 1638069 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking laravel.local (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests Server Software: nginx/1.9.3 Server Hostname: laravel.local Server Port: 80 Document Path: / Document Length: 12 bytes Concurrency Level: 100 Time taken for tests: 10.774 seconds Complete requests: 10000 Failed requests: 0 Total transferred: 2580000 bytes HTML transferred: 120000 bytes Requests per second: 928.19 [#/sec] (mean) Time per request: 107.737 [ms] (mean) Time per request: 1.077 [ms] (mean, across all concurrent requests) Transfer rate: 233.86 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 1 Processing: 4 107 10.0 105 130 Waiting: 4 107 10.0 105 130 Total: 5 107 10.0 105 130 Percentage of the requests served within a certain time (ms) 50% 105 66% 113 75% 114 80% 115 90% 117 95% 125 98% 128 99% 128 100% 130 (longest request)
Lumen 5.2
ab -c 100 -n 10000 http://lumen.local/ This is ApacheBench, Version 2.3 <$Revision: 1638069 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Licensed to The Apache Software Foundation, http://www.apache.org/ Benchmarking lumen.local (be patient) Completed 1000 requests Completed 2000 requests Completed 3000 requests Completed 4000 requests Completed 5000 requests Completed 6000 requests Completed 7000 requests Completed 8000 requests Completed 9000 requests Completed 10000 requests Finished 10000 requests Server Software: nginx/1.9.3 Server Hostname: lumen.local Server Port: 80 Document Path: / Document Length: 12 bytes Concurrency Level: 100 Time taken for tests: 1.789 seconds Complete requests: 10000 Failed requests: 0 Total transferred: 2110000 bytes HTML transferred: 120000 bytes Requests per second: 5589.13 [#/sec] (mean) Time per request: 17.892 [ms] (mean) Time per request: 0.179 [ms] (mean, across all concurrent requests) Transfer rate: 1151.67 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.1 0 2 Processing: 1 18 2.7 17 25 Waiting: 1 18 2.7 17 25 Total: 2 18 2.7 17 25 Percentage of the requests served within a certain time (ms) 50% 17 66% 18 75% 18 80% 19 90% 22 95% 24 98% 24 99% 24 100% 25 (longest request)
0 件のコメント:
コメントを投稿