I'm sorry if this sounds like a stupid question, because it seems to be one of those "no duh" things, but can someone explain to me why Rails needs its own server (Mongrel, WEBrick, mod_rails, etc) and can't simply use mod_ruby?
All apache instances running mod_ruby share a Ruby interpreter. This means that it can't be used at all on shared hosts, or in any environment where there are multiple Rails applications running per machine. In might be possible to run multiple copies of the same application on one machine but you could also easily experience difficult to track down bugs. Because rails is single threaded, running only one ruby process per machine is sort of unthinkable.
Also, it doesn't perform all that well.
For a more in depth discussion, check out this Phusion employee's blog
It has already been answered that mod_ruby results in a shared Ruby interpreter but the reason this is particularly problematic is that it means classes trample over each other. For example, consider ActiveRecord::Base which defines a connection to a certain database. The state of this class is different between different Rails applications, so as soon as more than one Rails application were to be run on the same interpreter, you have serious class warfare.
Another answer stated that Rails is single threaded, but this is not necessarily true as of Rails 2.2.2. I'd leave this as a comment on that answer but I'm in a karma straitjacket :)
"mod_ruby uses one interpreter per Apache process, which means that apps walk all over each other in the namespaces. At least for Rails, that's not acceptable, so it's 1 app per Apache setup if you want mod_ruby." - David Heinemeier Hansson
Now that it's been derided some, if you still want to use it, check out the mod_ruby FAQ
Dreamhost did try to include ruby into their hosting environment, this from their blog on their conclusions from this endeavor.
© 2022 - 2024 — McMap. All rights reserved.