Note this simple config.ru:
run lambda { |env|
puts "Request URI: #{env["REQUEST_URI"]}"
[201, {'Content-Type'=>'text/plain'}, ["Bye World"]]
}
I've done tests with:
- apache 'ab' command sending 1000 requests with concurrency
20.
- Ruby 1.8.7 and 1.9.1p376 (thin1.8 and thin1.9).
- thin in pure event model and using threads ("--threaded").
Tests:
1) ~# thin1.8 -R config.ru start => 0.997 seconds
2) ~# thin1.8 -R config.ru --threaded start => 1.544 seconds
3) ~# thin1.9 -R config.ru start => 1.061 seconds
4) ~# thin1.9 -R config.ru --threaded start => 14.709 seconds !!!
An important point is that running the above commands in
foreground, the "puts" command displays "Request URI: /index.xml"
line by line, except in case 4 (thin1.9 --threaded) in which it's
wrongly displayed (lines mixed):
Request URI: /index.xml
Request URI: /index.xml
Request URI: /index.xmlRequest URI: /index.xmlRequest URI: /index.xmlRequest URI: /index.xmlRequest URI: /index.xmlRequest URI::/index.xmlRequest URI: /index.xmlRequest URI: /index.xmlRequest URI: /index.xml
Request URI: /index.xml
Request URI: /index.xml
Request URI: /index.xml