# why isn't mod ruby used more?

**URL:** <https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093>\
**Category:** rubyonrails-talk\
**Created:** [September 24, 2006, 6:40am UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093 "2006-09-24T06:40:07Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![snacktime](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@snacktime](https://discuss.rubyonrails.org/u/snacktime)\
**Post date:** [September 24, 2006, 6:40am UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/1 "2006-09-24T06:40:07Z")

</div>

I'm curious. There isn't much talk about it that I can find. Is there anything in particular that it's lacking?

Chris

---

<div class="post-metadata">

**Author:** ![Ezra\_Zygmuntowicz](https://avatars.discourse-cdn.com/v4/letter/e/958977/32.png) [@Ezra\_Zygmuntowicz](https://discuss.rubyonrails.org/u/Ezra_Zygmuntowicz)\
**Post date:** [September 24, 2006, 7:12am UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/2 "2006-09-24T07:12:32Z")

</div>

Hey Chris-

&nbsp;&nbsp;Well the main reason its not used more with rails is that you can only run one rails app per apache because mod\_ruby embeds one global ruby interpreter for the whole apache. Rails is not coded to deal with this fact so it doesn't work very well. AFAIK there is a patch somewhere that allows multiple rails apps on mod\_ruby but it never got much traction.

&nbsp;&nbsp;I use it for some simple sites with rhtml and rb files but not rails.

-Ezra

---

<div class="post-metadata">

**Author:** ![Long](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@Long](https://discuss.rubyonrails.org/u/Long)\
**Post date:** [September 24, 2006, 4:34pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/3 "2006-09-24T16:34:36Z")

</div>

"Ezra Zygmuntowicz" wrote

> \> \> I'm curious. There isn't much talk about it that I can find. Is \> there anything in particular that it's lacking? \> \> Chris
> 
> Hey Chris-
> 
> Well the main reason its not used more with rails is that you can  
> only run one rails app per apache because mod\_ruby embeds one global  
> ruby interpreter for the whole apache. Rails is not coded to deal  
> with this fact so it doesn't work very well. AFAIK there is a patch  
> somewhere that allows multiple rails apps on mod\_ruby but it never  
> got much traction.

Ezra,

Thanks for the bit of history. Would you know if FastCgi also have this issue with multiple apps?

Thanks,

Long

---

<div class="post-metadata">

**Author:** ![Ben\_Bleything](https://avatars.discourse-cdn.com/v4/letter/b/9dc877/32.png) [@Ben\_Bleything](https://discuss.rubyonrails.org/u/Ben_Bleything)\
**Post date:** [September 24, 2006, 5:13pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/4 "2006-09-24T17:13:37Z")

</div>

No, it doesn't. FCGI is basically a way to do normal CGI, but keep the interpreters resident between request. Each listener is its own isolated ruby process.

The reason why Rails doesn't work well with mod\_ruby with multiple apps is that with mod\_ruby, each Apache child has its own Ruby process... if two apps ran under the same apache, the interpreter's namespace would get hopelessly confused.

Ben

---

<div class="post-metadata">

**Author:** ![Tom\_Mornini1](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@Tom\_Mornini1](https://discuss.rubyonrails.org/u/Tom_Mornini1)\
**Post date:** [September 24, 2006, 5:19pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/5 "2006-09-24T17:19:19Z")

</div>

Hello Chris.

Leading edge thinking on deployment has moved away from FastCGI (which can host more than one application per web server) to towards mongrel, which can also host more than one application per web server.

mongrel is much easier and natural to setup and test than FastCGI, as is actively developed by an army of really smart people who have chosen to name themselves, collectively, Zed Shaw. 🙂

---

<div class="post-metadata">

**Author:** ![Long](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@Long](https://discuss.rubyonrails.org/u/Long)\
**Post date:** [September 24, 2006, 5:32pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/6 "2006-09-24T17:32:31Z")

</div>

"Ben Bleything" wrote:

> \> Thanks for the bit of history. Would you know if FastCgi also have this \> issue with multiple apps?
> 
> No, it doesn't. FCGI is basically a way to do normal CGI, but keep the interpreters resident between request. Each listener is its own isolated ruby process.
> 
> The reason why Rails doesn't work well with mod\_ruby with multiple apps is that with mod\_ruby, each Apache child has its own Ruby process... if two apps ran under the same apache, the interpreter's namespace would get hopelessly confused.

Thanks Ben! This is what I was hoping.

Cheers,

Long

---

<div class="post-metadata">

**Author:** ![Long](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@Long](https://discuss.rubyonrails.org/u/Long)\
**Post date:** [September 24, 2006, 6:59pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/7 "2006-09-24T18:59:01Z")

</div>

"Tom Mornini" wrote:

> \> "Ezra Zygmuntowicz" wrote \>\> \>\> \>\>\> I'm curious. There isn't much talk about it that I can find. Is \>\>\> there anything in particular that it's lacking? \>\>\> \>\>\> Chris \>\> \>\> Hey Chris- \>\> \>\> Well the main reason its not used more with rails is that you can \>\> only run one rails app per apache because mod\_ruby embeds one global \>\> ruby interpreter for the whole apache. Rails is not coded to deal \>\> with this fact so it doesn't work very well. AFAIK there is a patch \>\> somewhere that allows multiple rails apps on mod\_ruby but it never \>\> got much traction. \> \> Thanks for the bit of history. Would you know if FastCgi also have  
> \> this \> issue with multiple apps?
> 
> Hello Chris.
> 
> Leading edge thinking on deployment has moved away from FastCGI (which can host more than one application per web server) to towards mongrel, which can also host more than one application per web server.
> 
> mongrel is much easier and natural to setup and test than FastCGI, as is actively developed by an army of really smart people who have chosen to name themselves, collectively, Zed Shaw. 🙂

I would like to know more about Mongrel. What additional benefits does it have over FastCGI? Where can I read more about it?

Thanks,

Long

---

<div class="post-metadata">

**Author:** ![bitsweat](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bitsweat/32/591_2.png) [@bitsweat](https://discuss.rubyonrails.org/u/bitsweat)\
**Post date:** [September 24, 2006, 7:24pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/8 "2006-09-24T19:24:57Z")

</div>

For the leading-edge folks who have moved on from FastCGI: why did you, and for what sort of app? Have you seen [http://defendem.com/read/book/1](http://defendem.com/read/book/1) ?

jeremy

---

<div class="post-metadata">

**Author:** ![Vishnu\_Gopal](https://avatars.discourse-cdn.com/v4/letter/v/b9e5f3/32.png) [@Vishnu\_Gopal](https://discuss.rubyonrails.org/u/Vishnu_Gopal)\
**Post date:** [September 24, 2006, 7:29pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/9 "2006-09-24T19:29:50Z")

</div>

[http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)

Perform your own tests with the configuration and decide on what’s best for you. Litespeed web server is also a good option.

Vish

---

<div class="post-metadata">

**Author:** ![Long](https://avatars.discourse-cdn.com/v4/letter/l/e47774/32.png) [@Long](https://discuss.rubyonrails.org/u/Long)\
**Post date:** [September 24, 2006, 9:26pm UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/10 "2006-09-24T21:26:51Z")

</div>

> Have you seen [http://defendem.com/read/book/1](http://defendem.com/read/book/1) ?
> 
> [http://mongrel.rubyforge.org/](http://mongrel.rubyforge.org/)

Both of these links are good reads. So we have at least two architectures to scale rails with.

Thanks for the links to both.

Long

---

<div class="post-metadata">

**Author:** ![Tom\_Mornini1](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@Tom\_Mornini1](https://discuss.rubyonrails.org/u/Tom_Mornini1)\
**Post date:** [September 25, 2006, 2:55am UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/11 "2006-09-25T02:55:54Z")

</div>

> Leading edge thinking on deployment has moved away from FastCGI (which can host more than one application per web server) to towards mongrel, which can also host more than one application per web server.
> 
> For the leading-edge folks who have moved on from FastCGI: why did you

Because it's wonderful to live in an HTTP world. If something gets weird with FCGI, there's no way to "see" what's happening. With mongrel, you can hit mongrel directly with a browser and see what's happening.

All mongrel does is replace the FCGI plumbing with HTTP. Obviously, HTTP is better understood and more tools work with it.

As a good example, imagine you have a performance problem. Is it the front end HTTP server, or your application server? How do you test FCGI without involving the front end HTTP server?

You cannot, of course. With mongrel it's dead simple! You can use the same tools you use to test the whole chain...

> and for what sort of app? Have you seen [http://defendem.com/read/book/1](http://defendem.com/read/book/1) ?

I have not seen that, but I have designed Engine Yard, a business critical (Enterprise!) Rails application deployment service, along with Ezra Zygmuntowicz. We have been designing since February, and developing since late July, and I can assure you that mongrel is part of the Engine Yard solution. 🙂

---

<div class="post-metadata">

**Author:** ![bitsweat](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/bitsweat/32/591_2.png) [@bitsweat](https://discuss.rubyonrails.org/u/bitsweat)\
**Post date:** [September 25, 2006, 6:19am UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/12 "2006-09-25T06:19:26Z")

</div>

> Because it’s wonderful to live in an HTTP world. If something gets weird with FCGI, there’s no way to “see” what’s happening. With mongrel, you can hit mongrel directly with a browser and see what’s happening.
> 
> All mongrel does is replace the FCGI plumbing with HTTP. Obviously, HTTP is better understood and more tools work with it.
> 
> As a good example, imagine you have a performance problem. Is it the front end HTTP server, or your application server? How do you test
> 
> FCGI without involving the front end HTTP server?

Definitely. The transparency of HTTP and ease of setup are second to none.

> You cannot, of course. With mongrel it’s dead simple! You can use the same tools you use to test the whole chain…

On the other hand, managing traffic at a high level (HTTP proxy, HTTP protocol) increases response latency and munches CPU like a low level solution does not (TCP balancer, SCGI protocol).

> > and for what sort of app? Have you seen [http://defendem.com/read/](http://defendem.com/read/) book/1 ?
> 
> I have not seen that, but I have designed Engine Yard, a business critical (Enterprise!) Rails application deployment service, along with Ezra Zygmuntowicz. We have been designing since February, and
> 
> developing since late July, and I can assure you that mongrel is part of the Engine Yard solution. 🙂

Rockin. Good luck!

jeremy

---

<div class="post-metadata">

**Author:** ![snacktime](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@snacktime](https://discuss.rubyonrails.org/u/snacktime)\
**Post date:** [September 26, 2006, 7:52am UTC](https://discuss.rubyonrails.org/t/why-isnt-mod-ruby-used-more/2093/13 "2006-09-26T07:52:09Z")

</div>

Unless I'm completely misunderstanding mod\_ruby, it doesn't load an interpreter per process. If it did I'd be a happy camper. I think it just instantiates a new class for each request all from the same interpreter, but I could be way off there.
