views:

1172

answers:

2

Rails is now making multi-threaded applications possible, but it doesn't sound like it applies in every situation (for instance, if you're using Mongrel, it doesn't sound like this affects you at all).

When can you multi-thread your Rails application?

This article gives some more information about multi-threading pitfalls.

+1  A: 

As a rule of thumb, if you are planning to use Threads, most likely your approach is not the better one. Try first to elaborate more on why you need threads, and if you still need them, use them with care :)

MrM
+3  A: 

I would steer well clear of multithreaded applications in Ruby unless you're using JRuby. Ruby threads are not native threads, and in my experience they work very badly indeed. Also, Ruby's memory manager leaves a lot to be desired, so segregating by process rather than by thread turns out to be a much more production-ready approach.

JRuby is a different story. It uses Java's threads, which translate to native threads, and it uses Java's garbage collector, which is excellent.

Cameron Price