/
Thin ,
Sinatra (.. ruby asynchtest.rb)
, ; 2 , .
:
require 'sinatra'
require 'thin'
set :server, %w[thin]
get '/test' do
puts "[#{Time.now.strftime("%H:%M:%S")}] logging /test starts on thread_id:#{Thread.current.object_id} \n"
sleep 10
"[#{Time.now.strftime("%H:%M:%S")}] success - id:#{Thread.current.object_id} \n"
end
, HTTP- ( timestamp thread-id).
, ( cuncurrent), :
- 70098572502680
- 70098572602260
- 70098572485180
( , puts), () ( ).
wikipedia - Asynchronous_I/O:
- - -,
.
(Sinatra/thin) , curl () Thin ()
, ( ),
, , : *
@Holger: sleep , . , , , , , , node.js: , . /eventmachine .
: "is-sinatra-multi-threaded - concurrency ?
Node.js
, asynchtest.js node.js; asynchtest.rb, , , ;
asynchtest.rb:
var express = require('express');
var app = express();
app.get('/test', function(req, res){
console.log("[" + getTime() + "] logging /test starts\n");
setTimeout(function(){
console.log("sleep doen't block, and now return");
res.send('[' + getTime() + '] success \n');
},10000);
});
var server = app.listen(3000,function(){
console.log("listening on port %d", server.address().port);
});
nodejs :

, , .
, , .