#118 open
Iñaki Baz Castillo

--threaded makes Thin very very slow under Ruby1.9

Reported by Iñaki Baz Castillo | December 19th, 2009 @ 07:54 PM | in Future

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").


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

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket