Hola gente!
En este thread de la lista de Node.js
alguien afirmo: "Rails is single thread"
No estoy seguro que sea el caso.
Por un lado, encuentro que hay soporte de threads en 1.9 YARV (algo asi habia entendido en la RubyConf del anio pasado, y que antes solo habia "green threads", digamos, threads de mentiritas ;-)
all modern Ruby VMs that run Rails (Ruby 1.9′s YARV, Rubinius, and JRuby) use native threads, eliminating the annoying tax that you need to pay for using threads in Ruby 1.8.
Por otro lado, leo
Even better, while Ruby originally started out with a "green threads" implementation which executed threads in userspace and could not provide multicore concurrency, newer, more modern Ruby implementations emerged which provided true native multithreading. JRuby and IronRuby, implementations of Ruby on the JVM and .NET CLR respectively, provided truly concurrent native multithreading while still maintaining Ruby's original threading API. Rubinius, a clean-room implementation of a Ruby VM based on the Smalltalk 80 architecture, has started to take steps to remove its global lock and allow concurrent multithreading as well
Que NO MENCIONA a Ruby 1.9 YARV, supongo porque en ese fecha no existia, es asi?
Ahora, dejando de lado si la Ruby VM tiene o no soporte de threads nativos, leo
encuentro que Rails hace algo:
The first item on the rack stack is Rack::Lock. This puts a lock around each request, so only one request is handled at a time. As such a standard rails app is single threaded. You can however spawn new threads within a request that would make your app multi threaded, most people never encounter this.
Sigue siendo asi? Se saco eso en alguna version de Rails? Porque necesita ese lock? Se puede quitar? Como es?
Nos leemos!
Angel "Java" Lopez