HTTPサーバのパフォーマンス比較

vegeta attackをつかって Apache, OpenliteSpeed, Nginx+PHP-FPM, h2o+PHP-FPMでパフォーマンスを比較してみた。

測定対象のPHPファイルは次のようなコード

<?php
echo 'Hello World'.date('Y-m-d h:i:s').PHP_EOL;
var_dump($_SERVER['SERVER_SOFTWARE']);

vegeta attackは次のような感じで10秒間負荷をかけた

vegeta -cpus=4 attack -targets="apache_target.txt" -duration=10s -output result_apache.bin
sleep 5

vegeta -cpus=4 attack -targets="openlite_target.txt" -duration=10s -output result_openlite.bin
sleep 5

vegeta -cpus=4 attack -targets="nginx_target.txt" -duration=10s -output result_nginx.bin
sleep 5

vegeta -cpus=4 attack -targets="h2o_target.txt" -duration=10s -output result_h2o.bin
sleep 5

平均レイテンシの結果は次の通り

Apache : 2.097692ms
OpenliteSpeed : 2.017002ms
Nginx+PHP-FPM : 1.865207ms
h2o+PHP-FPM : 2.427734ms

中央値などの詳細なデータはこのような感じ

Apache ======================
Requests      [total, rate, throughput]  500, 50.05, 50.03
Duration      [total, attack, wait]      9.9930604s, 9.9895491s, 3.5113ms
Latencies     [mean, 50, 95, 99, max]    2.097692ms, 1.586491ms, 3.712122ms, 7.52365ms, 13.3605ms
Bytes In      [total, mean]              33500, 67.00
Bytes Out     [total, mean]              0, 0.00
Success       [ratio]                    100.00%
Status Codes  [code:count]               200:500
Error Set:
openlite speed ======================
Requests      [total, rate, throughput]  500, 50.07, 50.06
Duration      [total, attack, wait]      9.9877642s, 9.986254s, 1.5102ms
Latencies     [mean, 50, 95, 99, max]    2.017002ms, 1.712651ms, 3.548116ms, 6.54955ms, 26.4052ms
Bytes In      [total, mean]              26500, 53.00
Bytes Out     [total, mean]              0, 0.00
Success       [ratio]                    100.00%
Status Codes  [code:count]               200:500
Error Set:
Nginx and PHP-FPM ======================
Requests      [total, rate, throughput]  500, 50.06, 50.05
Duration      [total, attack, wait]      9.9903362s, 9.9887394s, 1.5968ms
Latencies     [mean, 50, 95, 99, max]    1.865207ms, 1.518298ms, 3.635994ms, 6.64155ms, 11.6384ms
Bytes In      [total, mean]              28500, 57.00
Bytes Out     [total, mean]              0, 0.00
Success       [ratio]                    100.00%
Status Codes  [code:count]               200:500
Error Set:
h2o and PHP-FPM ======================
Requests      [total, rate, throughput]  500, 50.12, 50.11
Duration      [total, attack, wait]      9.9780712s, 9.9755576s, 2.5136ms
Latencies     [mean, 50, 95, 99, max]    2.427734ms, 2.12775ms, 4.569433ms, 6.9608ms, 10.5099ms
Bytes In      [total, mean]              26500, 53.00
Bytes Out     [total, mean]              0, 0.00
Success       [ratio]                    100.00%
Status Codes  [code:count]               200:500
Error Set:

Apache

OpenliteSpeed

Nginx

h2o

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です