RedMineをthin/mongrel/webrickでそれぞれ動かしてabしてみた
thinていうMongrel代替みたいな軽量サーバがあるらしいのでどれくらい軽量なのか軽く試してみた。mod_proxy_balancer+クラスターを使わずab直撃、かつ裏でmp3再生しながらOperaでタブ70個開いたりしてるので厳密なベンチマークではないことにご留意を。
コマンド
# ruby -v ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux] # /usr/sbin/ab -c 25 -n 500 http://localhost:3000/ This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0 Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ Copyright 2006 The Apache Software Foundation, http://www.apache.org/ ...
thin
# thin --version thin 0.7.0 codename Spherical Cow # thin start -d -e production
Server Software: thin
Server Hostname: localhost
Server Port: 3000
Document Path: /
Document Length: 3183 bytes
Concurrency Level: 25
Time taken for tests: 8.948900 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 1753000 bytes
HTML transferred: 1591500 bytes
Requests per second: 55.87 [#/sec] (mean)
Time per request: 447.445 [ms] (mean)
Time per request: 17.898 [ms] (mean, across all concurrent requests)
Transfer rate: 191.20 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 305 443 150.0 423 1292
Waiting: 192 303 125.8 286 1080
Total: 305 443 150.1 423 1292
Percentage of the requests served within a certain time (ms)
50% 423
66% 439
75% 453
80% 478
90% 517
95% 742
98% 1079
99% 1292
100% 1292 (longest request)
mongrel
# mongrel_rails start --version Version 1.1.4 # mongrel_rails start -d -e production
Server Software: Mongrel
Server Hostname: localhost
Server Port: 3000
Document Path: /
Document Length: 3183 bytes
Concurrency Level: 25
Time taken for tests: 14.808434 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 1769500 bytes
HTML transferred: 1591500 bytes
Requests per second: 33.76 [#/sec] (mean)
Time per request: 740.422 [ms] (mean)
Time per request: 29.617 [ms] (mean, across all concurrent requests)
Transfer rate: 116.69 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 358 728 666.2 483 3413
Waiting: 358 728 666.2 483 3413
Total: 358 728 666.3 483 3413
Percentage of the requests served within a certain time (ms)
50% 483
66% 501
75% 556
80% 581
90% 1580
95% 2704
98% 3241
99% 3333
100% 3413 (longest request)
webrick
# ruby script/server webrick -e production -d
Server Software: WEBrick/1.3.1
Server Hostname: localhost
Server Port: 3000
Document Path: /
Document Length: 3183 bytes
Concurrency Level: 25
Time taken for tests: 19.188079 seconds
Complete requests: 500
Failed requests: 0
Write errors: 0
Total transferred: 1774000 bytes
HTML transferred: 1591500 bytes
Requests per second: 26.06 [#/sec] (mean)
Time per request: 959.404 [ms] (mean)
Time per request: 38.376 [ms] (mean, across all concurrent requests)
Transfer rate: 90.26 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 2
Processing: 120 926 584.8 656 3060
Waiting: 118 923 585.1 652 3053
Total: 120 926 584.8 656 3060
Percentage of the requests served within a certain time (ms)
50% 656
66% 716
75% 754
80% 1517
90% 2064
95% 2196
98% 2288
99% 2324
100% 3060 (longest request)
結論
僕が普段使ってる環境で動かすならMongrelよりthinのほうがお得。WEBrickは遅いけど、数ヶ月前に見た噂によると勉強には適したソースコードだとか。
ていうかそういう意図なら-c 25である意味はまったくなかったなあ。まあいいか。
こめんと