● [Rails] 運用サーバ速度比較
- Pentium III(733MHz) Dual
- Ruby-1.8.4 (2005-12-24)
- Lighttpd-1.4.11
- Mongrel-0.3.12.4
- WEBrick-1.12
- Apache2-2.0.55
- LiteSpeed-2.1.16 Standard
● ベンチ1: Rails アプリケーション

[Railsアプリ]
コントローラ
class BenchController < ApplicationController
def index
render :text=>"maiha"
end
end |
- production mode
- config.frameworks -= [ :action_web_service, :action_mailer, :active_record ]
[apache2 の proxy の設定]
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /bench/ http://127.0.0.1:3000/bench/
ProxyPassReverse /bench/ http://127.0.0.1:3000/bench/
[計測方法]
% ab -n 100 http://localhost:3000/bench/
● ベンチ2: tDiary (2006/06/01〜2006/06/07のデータ)

● まとめ
- LiteSpeed + LSAPI(ruby-dispatch) が生 Lighttpd と同程度であることに驚いた。(無菌状態での精密なベンチではないので全体的に10%程度の誤差はありえる)
- Apache2 の proxy は全般的にオーバーヘッドが少ないが、LiteSpeed は Mongrel 以外のサーバとはなぜか相性が悪い。(LiteSpeed proxy は Mongrel 一択で)
- WEBrickが思ったほど遅くなかった。(今回は逐次アクセスで測定したので、並行処理の場合はまた違う結果になるのかも)
- ruby-runner を利用することで既存の Ruby CGIアプリが全て高速化されるのは嬉しい。(tDiary で3倍)
- 結局、高々5倍程度の差と思えば好きな鯖でよい。(生CGI だけはダメ、絶対)
ab の -c オプションを使えば並行処理のケースも測定できますね。完全なパラレルにはならないとは思いますが。
あ,言い忘れていた。<br>舞波 乙!