Thin Goliath WebRick对比

 

require 'goliath'
require 'json'

class Hello < Goliath::API

  def response(env)
  	case env["REQUEST_PATH"]
  	  when "/" then [200, {}, {:key => "hello world"}.to_json]
  	  when "/home/index"  then [200, {}, {:key => "hello world"}.to_json]
	end  	 	
  end
end

 

 

Server Software:        Goliath
Server Hostname:        127.0.0.1
Server Port:            9000

Document Path:          /home/index
Document Length:        21 bytes

Concurrency Level:      30
Time taken for tests:   1.757 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      114000 bytes
HTML transferred:       21000 bytes
Requests per second:    569.09 [#/sec] (mean)
Time per request:       52.715 [ms] (mean)
Time per request:       1.757 [ms] (mean, across all concurrent requests)
Transfer rate:          63.36 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:    26   52   8.5     51      76
Waiting:        8   37   9.1     35      60
Total:         26   52   8.5     51      77

Percentage of the requests served within a certain time (ms)
  50%     51
  66%     56
  75%     60
  80%     61
  90%     64
  95%     67
  98%     69
  99%     70
 100%     77 (longest request)
goliath(master) $ ab -c30 -n1000 http://127.0.0.1:9000/home/index

routes

 

  get "home/index"
  root :to => 'home#index'

 controller.rb

 

 

class HomeController < ApplicationController

  def index
    render :json => {:key => "hello world"}.to_json
  end
end

 

 

Server Software:        WEBrick/1.3.1
Server Hostname:        127.0.0.1
Server Port:            3000

Document Path:          /home/index
Document Length:        21 bytes

Concurrency Level:      30
Time taken for tests:   3.187 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      400000 bytes
HTML transferred:       21000 bytes
Requests per second:    313.74 [#/sec] (mean)
Time per request:       95.622 [ms] (mean)
Time per request:       3.187 [ms] (mean, across all concurrent requests)
Transfer rate:          122.55 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   18 132.9      0    1000
Processing:     7   77  50.0     82     738
Waiting:        7   76  50.0     81     737
Total:          7   95 162.9     82    1738

Percentage of the requests served within a certain time (ms)
  50%     82
  66%     89
  75%     98
  80%    100
  90%    108
  95%    119
  98%    179
  99%   1068
 100%   1738 (longest request)
fluentd-0.12.8 $ ab -c 30 -n 1000 http://127.0.0.1:3000/home/index

modify Gemfile

 

gem 'thin'

start app

 

 thin -R config.ru -a 127.0.0.1 -p 3000 start

 

Server Software:        thin
Server Hostname:        127.0.0.1
Server Port:            3000

Document Path:          /home/index
Document Length:        21 bytes

Concurrency Level:      30
Time taken for tests:   1.474 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      309000 bytes
HTML transferred:       21000 bytes
Requests per second:    678.37 [#/sec] (mean)
Time per request:       44.224 [ms] (mean)
Time per request:       1.474 [ms] (mean, across all concurrent requests)
Transfer rate:          204.70 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       1
Processing:    19   44  11.4     39      90
Waiting:       12   30  10.3     26      77
Total:         19   44  11.4     39      90

Percentage of the requests served within a certain time (ms)
  50%     39
  66%     44
  75%     50
  80%     53
  90%     65
  95%     67
  98%     74
  99%     77
 100%     90 (longest request)
fluentd-0.12.8 $ ab -c 30 -n 1000 http://127.0.0.1:3000/home/index

你可能感兴趣的:(thin,goliath,WebRick)