技術ネタ: 2014年9月アーカイブ

どうも。

秋風に身を切られる思いです。

去年くらいにちらほら出てきたnodejsでのrails系フレームワークの「sails」。
今後使えるのかどうか、またどのくらいベンチが出るんだろうかと思い、ベンチを取ってみました。

使ったのは下記のrailsとsailsのサンプルアプリケーションをherokuに上げました。

rails_sample / github
rails-sample / heroku

sails-sample / github
sails-sample / heroku

これを、apコマンドにてvps(gmo)から叩きます。各アプリケーション共に、controllerを通した上での静的ページと、10件ほどのデータを読み込んで表示させる動的なページを用意して計測しました。

結果

rails static
-----------------
$ ab -n 10000 -c 1000 http://rails-sample1.herokuapp.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking rails-sample1.herokuapp.com (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:        WEBrick/1.3.1
Server Hostname:        rails-sample1.herokuapp.com
Server Port:            80

Document Path:          /
Document Length:        485 bytes

Concurrency Level:      1000
Time taken for tests:   82.283 seconds
Complete requests:      10000
Failed requests:        5
   (Connect: 0, Receive: 0, Length: 5, Exceptions: 0)
Write errors:           0
Non-2xx responses:      4
Total transferred:      13326011 bytes
HTML transferred:       4849511 bytes
Requests per second:    121.53 [#/sec] (mean)
Time per request:       8228.335 [ms] (mean)
Time per request:       8.228 [ms] (mean, across all concurrent requests)
Transfer rate:          158.16 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      161  174   8.1    174     265
Processing:   319 7201 7033.1   4750   59446
Waiting:        0 7193 7013.9   4749   57805
Total:        482 7375 7034.8   4926   59640

Percentage of the requests served within a certain time (ms)
  50%   4926
  66%   6972
  75%   8933
  80%  10621
  90%  16468
  95%  21636
  98%  30056
  99%  35091
 100%  59640 (longest request)

 sails static
-----------------
$ ab -n 10000 -c 1000 http://sails-sample.herokuapp.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking sails-sample.herokuapp.com (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:        Cowboy
Server Hostname:        sails-sample.herokuapp.com
Server Port:            80

Document Path:          /
Document Length:        3402 bytes

Concurrency Level:      1000
Time taken for tests:   41.820 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      38747605 bytes
HTML transferred:       34030206 bytes
Requests per second:    239.12 [#/sec] (mean)
Time per request:       4182.031 [ms] (mean)
Time per request:       4.182 [ms] (mean, across all concurrent requests)
Transfer rate:          904.81 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      161  174   7.3    174     202
Processing:   191 3755 2167.6   3234   26811
Waiting:      191 3753 2167.5   3232   26811
Total:        353 3929 2167.7   3408   26989

Percentage of the requests served within a certain time (ms)
  50%   3408
  66%   3995
  75%   4392
  80%   4828
  90%   6443
  95%   8117
  98%  10287
  99%  12197
 100%  26989 (longest request)

  rails dynamic
---------------------
$ ab -n 10000 -c 1000 http://rails-sample1.herokuapp.com/users
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking rails-sample1.herokuapp.com (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:        WEBrick/1.3.1
Server Hostname:        rails-sample1.herokuapp.com
Server Port:            80

Document Path:          /users
Document Length:        1063 bytes

Concurrency Level:      1000
Time taken for tests:   113.274 seconds
Complete requests:      10000
Failed requests:        122
   (Connect: 0, Receive: 0, Length: 122, Exceptions: 0)
Write errors:           0
Non-2xx responses:      17
Total transferred:      18898109 bytes
HTML transferred:       10508542 bytes
Requests per second:    88.28 [#/sec] (mean)
Time per request:       11327.374 [ms] (mean)
Time per request:       11.327 [ms] (mean, across all concurrent requests)
Transfer rate:          162.93 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      161  175  11.9    174     492
Processing:   301 10530 10858.2   6178   60166
Waiting:        0 9899 9647.1   5972   59731
Total:        463 10705 10859.6   6364   60342

Percentage of the requests served within a certain time (ms)
  50%   6364
  66%   9713
  75%  13072
  80%  15779
  90%  24772
  95%  34554
  98%  47397
  99%  59697
 100%  60342 (longest request)

  sails dynamic
----------------------------------
$ ab -n 10000 -c 1000 http://sails-sample.herokuapp.com/users
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking sails-sample.herokuapp.com (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:        Cowboy
Server Hostname:        sails-sample.herokuapp.com
Server Port:            80

Document Path:          /users
Document Length:        4151 bytes

Concurrency Level:      1000
Time taken for tests:   56.927 seconds
Complete requests:      10000
Failed requests:        0
Write errors:           0
Total transferred:      46226812 bytes
HTML transferred:       41510000 bytes
Requests per second:    175.66 [#/sec] (mean)
Time per request:       5692.734 [ms] (mean)
Time per request:       5.693 [ms] (mean, across all concurrent requests)
Transfer rate:          793.00 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:      161  174   7.0    174     204
Processing:  2293 5336 662.6   5411    8014
Waiting:     2292 5335 662.6   5410    8013
Total:       2456 5510 664.5   5584    8209

Percentage of the requests served within a certain time (ms)
  50%   5584
  66%   5687
  75%   5759
  80%   5810
  90%   6091
  95%   6234
  98%   7079
  99%   7591
 100%   8209 (longest request)

といった感じで、

ページアプリケーションRequests per second
静的 rails 121.53
静的 sails 239.12
動的 rails 88.28
動的 sails 175.66

割りと有意な結果が出たような気がします。

もうちょっと他のフレームワークも欲しいですね。

ではでは。

1