Do we really need multi-threaded web applications?

April 17, 2008

I've given a few presentations on Merb now and had the chance to discuss Merb with several different people. One point people have mentioned is that Rails is single threaded by design, not as a limitation as I've sort of implied in the talks I've given. Rails being single threaded relieves the developer from thinking about threading issues, which can cause bugs that hard to track down and test for. Sure, this makes it theoretically less efficient than a multi-threaded app, but that may be a small price to pay.

On the other hand, before doing Rails I was doing multi-threaded web applications in Java/J2EE for years and I never ran into threading issues. Most MVC frameworks made it pretty easy to avoid those types of problems and it was easy enough to just make sure that any servlets that I would write wouldn't use any shared data. Threading issues were something you had to kind in the back of your mind, but I never really had any problems.

So do we need multi-threaded web applications or do the potential complexities introduced by threading outweigh that benefit? And how much resource utilization/performance benefit is there to be gained by making our Ruby web apps multi-threaded?

Posted in Technology | Tags Merb, Ruby, Rails



This has topic has crossed my mind a lot since coming over from j2ee and being a ruby newbie. The one thing that I can't wrap my head around is handling concurrent users. If my site consistently has say 2 concurrent users does that mean I need to have two rails servers running to be able to adequately support them?

# Posted By Randy on Thursday, July 8 2010 at 9:43 PM

Comments Disabled