Created
March 14, 2014 19:32
-
-
Save yorickpeterse/9555037 to your computer and use it in GitHub Desktop.
Accurate proof that Ruby is closer to the bear metal than Node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
siege -c 10 -b -t 30s http://localhost:9393 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
siege -c 10 -b -t 30s http://localhost:9292 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rack' | |
class Application | |
def call(env) | |
return [200, {'Content-Type' => 'text/plain'}, ['Hello world']] | |
end | |
end | |
run Application.new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var server = http.createServer(function(request, response) | |
{ | |
response.writeHead(200, {'Content-Type': 'text/plain'}); | |
response.end('Hello world'); | |
}); | |
server.listen(9393, '0.0.0.0'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]: | |
** SIEGE 3.0.5 | |
** Preparing 10 concurrent users for battle. | |
The server is now under siege... | |
Lifting the server siege... done. | |
Transactions: 158092 hits | |
Availability: 100.00 % | |
Elapsed time: 29.06 secs | |
Data transferred: 1.66 MB | |
Response time: 0.00 secs | |
Transaction rate: 5440.19 trans/sec | |
Throughput: 0.06 MB/sec | |
Concurrency: 9.90 | |
Successful transactions: 158092 | |
Failed transactions: 0 | |
Longest transaction: 0.02 | |
Shortest transaction: 0.00 | |
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]: | |
** SIEGE 3.0.5 | |
** Preparing 10 concurrent users for battle. | |
The server is now under siege... | |
Lifting the server siege... done. | |
Transactions: 222639 hits | |
Availability: 100.00 % | |
Elapsed time: 29.91 secs | |
Data transferred: 2.34 MB | |
Response time: 0.00 secs | |
Transaction rate: 7443.63 trans/sec | |
Throughput: 0.08 MB/sec | |
Concurrency: 9.88 | |
Successful transactions: 222639 | |
Failed transactions: 0 | |
Longest transaction: 0.02 | |
Shortest transaction: 0.00 | |
rubinius 2.2.6.n73 (2.1.0 f3c12adf 2014-03-14 JI) [x86_64-linux-gnu]: | |
** SIEGE 3.0.5 | |
** Preparing 10 concurrent users for battle. | |
The server is now under siege... | |
Lifting the server siege... done. | |
Transactions: 103199 hits | |
Availability: 100.00 % | |
Elapsed time: 29.28 secs | |
Data transferred: 1.08 MB | |
Response time: 0.00 secs | |
Transaction rate: 3524.56 trans/sec | |
Throughput: 0.04 MB/sec | |
Concurrency: 9.94 | |
Successful transactions: 103199 | |
Failed transactions: 0 | |
Longest transaction: 0.11 | |
Shortest transaction: 0.00 | |
jruby 1.7.10 (1.9.3p392) 2014-01-09 c4ecd6b on OpenJDK 64-Bit Server VM 1.7.0_51-b31 [linux-amd64]: | |
** SIEGE 3.0.5 | |
** Preparing 10 concurrent users for battle. | |
The server is now under siege... | |
Lifting the server siege... done. | |
Transactions: 180525 hits | |
Availability: 100.00 % | |
Elapsed time: 29.82 secs | |
Data transferred: 1.89 MB | |
Response time: 0.00 secs | |
Transaction rate: 6053.82 trans/sec | |
Throughput: 0.06 MB/sec | |
Concurrency: 9.90 | |
Successful transactions: 180525 | |
Failed transactions: 0 | |
Longest transaction: 0.06 | |
Shortest transaction: 0.00 | |
Node.js v0.10.26: | |
** SIEGE 3.0.5 | |
** Preparing 10 concurrent users for battle. | |
The server is now under siege... | |
Lifting the server siege... done. | |
Transactions: 190550 hits | |
Availability: 100.00 % | |
Elapsed time: 29.91 secs | |
Data transferred: 2.00 MB | |
Response time: 0.00 secs | |
Transaction rate: 6370.78 trans/sec | |
Throughput: 0.07 MB/sec | |
Concurrency: 9.92 | |
Successful transactions: 190550 | |
Failed transactions: 0 | |
Longest transaction: 0.02 | |
Shortest transaction: 0.00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo 'Node version:' | |
node --version | |
node node.js |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo 'Ruby version:' | |
ruby --version | |
export RACK_ENV=none | |
puma -e none -p 9292 -t 64:128 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I feel like you're essentially recreating the plaintext test of the techempower benchmarks but with less warmup time and a slower server choice for JRuby. Here's a link to their latest published results, filtered to show only nodejs, rack-jruby, and rack-ruby.
http://www.techempower.com/benchmarks/#section=data-r8&hw=i7&test=plaintext&f=g0-0-0
In case you don't follow the link or it breaks: rack-jruby 269k req/s, nodejs 80k req/s, and rack-ruby 69k req/s.
The JSON parsing results at http://www.techempower.com/benchmarks/#section=data-r8&hw=i7&test=json&f=g0-0-0 are similar, with rack-jruby at 186k req/s, nodejs at 71k req/s, and rack-ruby at 61k req/s.
They don't have Rubinius in their test suite, but would probably be open to adding it for future rounds. You can try to recreate the jruby/ruby/node results by replacing puma with the 'torqbox' gem for jruby and unicorn behind nginx for ruby.