# \<Mongrel noob\>: Verifying start/stop order of processes

**URL:** <https://www.ruby-forum.com/t/mongrel-noob-verifying-start-stop-order-of-processes/131317>\
**Category:** Rails\
**Created:** [March 8, 2008, 1:14am UTC](https://www.ruby-forum.com/t/mongrel-noob-verifying-start-stop-order-of-processes/131317 "2008-03-08T01:14:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 8, 2008, 1:14am UTC](https://www.ruby-forum.com/t/mongrel-noob-verifying-start-stop-order-of-processes/131317/1 "2008-03-08T01:14:43Z")

</div>

Is it best practice/correct to:

Start Mongrel, then Apache

and conversely,

Stop Apache, then Mongrel

on server startup and shutdown?

Thanks,  
Wes

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 8, 2008, 1:28am UTC](https://www.ruby-forum.com/t/mongrel-noob-verifying-start-stop-order-of-processes/131317/2 "2008-03-08T01:28:35Z")

</div>

On Mar 7, 4:14 pm, Wes G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Thanks,  
> Wes

I don’t see how it would matter, but I tend to start Apache first,  
then my mongrels. In the startup scenario, Apache will return a “bad  
gateway (503, I think)” if your mongrel is not yet started. However,  
the time it takes to start Apache and a pack of mongrels is pretty  
short, so you probably won’t have any problems. If your mongrels are  
started first, they will listen until they get pinged on their port.  
Starting Apache second ensures that the first request served can be  
proxied to a mongrel.

The takedown scenario just can’t matter. Again, if you shut off the  
mongrels first and a request comes in, Apache will return a bad  
gateway, but presumably, Apache will be gone too in a short bit, and  
there will be no trace of a server on port 80, right? So if you really  
don’t want to serve up those bad gateway pages, then take Apache down  
first, then the mongrels.

---

<div class="post-metadata">

**Author:** ![weyus](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/7ab992/32.png) [@weyus](https://www.ruby-forum.com/u/weyus)\
**Post date:** [March 8, 2008, 1:49pm UTC](https://www.ruby-forum.com/t/mongrel-noob-verifying-start-stop-order-of-processes/131317/3 "2008-03-08T13:49:12Z")

</div>

On 8 Mar 2008, at 00:27, s.ross wrote:

> > 
> 
> started first, they will listen until they get pinged on their port.  
> Starting Apache second ensures that the first request served can be  
> proxied to a mongrel.

I start mongrels, then apache. Depending on how your apache is setup,  
if people try to access your site then apache will try to talk to the  
mongrels and fail, and by default apache has some sort of cool off  
period where even when you have brought the mongrels back up it will  
still show those 503s for that cooloff period.

Fred
