Skip to content

Instantly share code, notes, and snippets.

@Lightpower
Created December 10, 2012 16:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lightpower/4251638 to your computer and use it in GitHub Desktop.
Save Lightpower/4251638 to your computer and use it in GitHub Desktop.
rails-api vs sinatra
bva@bva-X51L:~/work/performance_tests/sinatra-test$ ab -n 1000 -c 10 -t 8 0.0.0.0:3000/tests
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 0.0.0.0 (be patient)
Finished 171 requests
Server Software: thin
Server Hostname: 0.0.0.0
Server Port: 3000
Document Path: /tests
Document Length: 4959 bytes
Concurrency Level: 10
Time taken for tests: 8.274 seconds
Complete requests: 171
Failed requests: 0
Write errors: 0
Total transferred: 947520 bytes
HTML transferred: 892620 bytes
Requests per second: 20.67 [#/sec] (mean)
Time per request: 483.833 [ms] (mean)
Time per request: 48.383 [ms] (mean, across all concurrent requests)
Transfer rate: 111.84 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 349 465 332.7 383 1795
Waiting: 349 464 332.7 383 1794
Total: 349 465 332.7 384 1795
Percentage of the requests served within a certain time (ms)
50% 383
66% 386
75% 388
80% 394
90% 433
95% 1795
98% 1795
99% 1795
100% 1795 (longest request)
bva@bva-X51L:~/work/performance_tests/sinatra-test$ ab -n 1000 -c 10 -t 8 0.0.0.0:3000/tests
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 0.0.0.0 (be patient)
Finished 171 requests
Server Software: thin
Server Hostname: 0.0.0.0
Server Port: 3000
Document Path: /tests
Document Length: 4959 bytes
Concurrency Level: 10
Time taken for tests: 8.284 seconds
Complete requests: 171
Failed requests: 0
Write errors: 0
Total transferred: 947520 bytes
HTML transferred: 892620 bytes
Requests per second: 20.64 [#/sec] (mean)
Time per request: 484.423 [ms] (mean)
Time per request: 48.442 [ms] (mean, across all concurrent requests)
Transfer rate: 111.70 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 346 466 392.7 372 2036
Waiting: 346 465 392.7 371 2036
Total: 346 466 392.8 372 2037
Percentage of the requests served within a certain time (ms)
50% 372
66% 380
75% 382
80% 384
90% 390
95% 2037
98% 2037
99% 2037
100% 2037 (longest request)
bva@bva-X51L:~/work/performance_tests/sinatra-test$ ab -n 1000 -c 10 -t 8 0.0.0.0:9292/tests
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 0.0.0.0 (be patient)
Finished 211 requests
Server Software: thin
Server Hostname: 0.0.0.0
Server Port: 9292
Document Path: /tests
Document Length: 4959 bytes
Concurrency Level: 10
Time taken for tests: 8.055 seconds
Complete requests: 211
Failed requests: 0
Write errors: 0
Total transferred: 1134100 bytes
HTML transferred: 1090980 bytes
Requests per second: 26.19 [#/sec] (mean)
Time per request: 381.775 [ms] (mean)
Time per request: 38.177 [ms] (mean, across all concurrent requests)
Transfer rate: 137.49 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.1 0 1
Processing: 310 365 47.6 348 552
Waiting: 309 364 47.6 347 551
Total: 310 366 47.6 348 552
Percentage of the requests served within a certain time (ms)
50% 348
66% 374
75% 378
80% 380
90% 388
95% 396
98% 552
99% 552
100% 552 (longest request)
class TestsController < ApplicationController
def index
array = []
100.times { |i| array <<{a: i, b: "qwe#{i}", c: {a1: i*100, b1: "asd#{i}"} } }
render json: array
end
end
require 'sinatra'
get "/tests" do
array = []
100.times { |i| array <<{a: i, b: "qwe#{i}", c: {a1: i*100, b1: "asd#{i}"} } }
array.to_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment