Created
September 13, 2012 15:48
-
-
Save bogdanconstantinescu/3715241 to your computer and use it in GitHub Desktop.
Revisions
-
bogdanconstantinescu revised this gist
Sep 13, 2012 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ - ruby 1.9.3p194 - async_sinatra (1.0.0) - thin (1.2.11) <pre> thin start -
bogdanconstantinescu revised this gist
Sep 13, 2012 . 1 changed file with 9 additions and 5 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -3,12 +3,13 @@ - ruby 1.9.3p194 - async_sinatra (1.0.0) - thin (1.2.11) <pre> thin start ab -n 10000 -c 100 http://127.0.0.1:3000/ </pre> <pre> Server Software: thin Server Hostname: 127.0.0.1 Server Port: 3000 @@ -45,17 +46,20 @@ 98% 78 99% 94 100% 119 (longest request) </pre> # Node.js - node v0.8.8 - express 3.0.0rc4 <pre> node app.js ab -n 10000 -c 100 http://localhost:3001/ </pre> <pre> Server Software: Server Hostname: 127.0.0.1 Server Port: 3001 @@ -92,7 +96,7 @@ 98% 299 99% 312 100% 405 (longest request) </pre> # Conclusion Ruby still has it (besides being a beautiful language). -
bogdanconstantinescu revised this gist
Sep 13, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ - async_sinatra (1.0.0) - thin (1.2.11) thin start ab -n 10000 -c 100 http://127.0.0.1:3000/ -
There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ source 'https://rubygems.org' gem 'thin' gem 'bundler' gem 'async_sinatra' gem 'thin' 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,98 @@ # Async Sinatra - ruby 1.9.3p194 - async_sinatra (1.0.0) - thin (1.2.11) thin start ab -n 10000 -c 100 http://127.0.0.1:3000/ Server Software: thin Server Hostname: 127.0.0.1 Server Port: 3000 Document Path: / Document Length: 11 bytes Concurrency Level: 100 Time taken for tests: 5.439 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 1530000 bytes HTML transferred: 110000 bytes Requests per second: 1838.52 [#/sec] (mean) Time per request: 54.391 [ms] (mean) Time per request: 0.544 [ms] (mean, across all concurrent requests) Transfer rate: 274.70 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 1 2.0 1 37 Processing: 15 53 10.8 52 119 Waiting: 12 49 10.1 48 96 Total: 25 54 10.6 53 119 Percentage of the requests served within a certain time (ms) 50% 53 66% 57 75% 61 80% 62 90% 65 95% 72 98% 78 99% 94 100% 119 (longest request) # Node.js - node v0.8.8 - express 3.0.0rc4 node app.js ab -n 10000 -c 100 http://localhost:3001/ Server Software: Server Hostname: 127.0.0.1 Server Port: 3001 Document Path: / Document Length: 170 bytes Concurrency Level: 100 Time taken for tests: 14.909 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 3290000 bytes HTML transferred: 1700000 bytes Requests per second: 670.71 [#/sec] (mean) Time per request: 149.095 [ms] (mean) Time per request: 1.491 [ms] (mean, across all concurrent requests) Transfer rate: 215.49 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.8 0 21 Processing: 2 148 84.1 146 405 Waiting: 2 148 84.1 146 405 Total: 2 148 84.1 146 405 Percentage of the requests served within a certain time (ms) 50% 146 66% 192 75% 218 80% 233 90% 263 95% 281 98% 299 99% 312 100% 405 (longest request) # Conclusion Ruby still has it (besides being a beautiful language). 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,36 @@ //Nothe this is a default installation on Express.js /** * Module dependencies. */ var express = require('express') , routes = require('./routes') , user = require('./routes/user') , http = require('http') , path = require('path'); var app = express(); app.configure(function(){ app.set('port', process.env.PORT || 3001); app.set('views', __dirname + '/views'); app.set('view engine', 'jade'); app.use(express.favicon()); app.use(express.logger('dev')); app.use(express.bodyParser()); app.use(express.methodOverride()); app.use(app.router); app.use(express.static(path.join(__dirname, 'public'))); }); app.configure('development', function(){ app.use(express.errorHandler()); }); app.get('/', routes.index); app.get('/users', user.list); http.createServer(app).listen(app.get('port'), function(){ console.log("Express server listening on port " + app.get('port')); }); 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,14 @@ # default example for async_sinatra gem require 'sinatra/async' class App < Sinatra::Base register Sinatra::Async aget '/' do body "hello async" end aget '/delay/:n' do |n| EM.add_timer(n.to_i) { body { "delayed for #{n} seconds" } } end end 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ require './app' run App