# Mongrel, static files, and haproxy healtchecks

**URL:** <https://www.ruby-forum.com/t/mongrel-static-files-and-haproxy-healtchecks/176664>\
**Category:** Rails\
**Created:** [October 4, 2009, 12:39pm UTC](https://www.ruby-forum.com/t/mongrel-static-files-and-haproxy-healtchecks/176664 "2009-10-04T12:39:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![buddy12lbcat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cab0a1/32.png) [@buddy12lbcat](https://www.ruby-forum.com/u/buddy12lbcat)\
**Post date:** [October 4, 2009, 12:39pm UTC](https://www.ruby-forum.com/t/mongrel-static-files-and-haproxy-healtchecks/176664/1 "2009-10-04T12:39:23Z")

</div>

hi,

a question to the group:

am i right in thinking that rails routing occurs outside (before) the  
mutex lock on dispatch such that static files get served up on a  
different thread than rails script requests. they both go through  
routes.rb though.

if that is the case then i shouldn’t have to worry about haproxy  
sending health checks to my mongrel blocking actual rails requests as  
long as the checks are requesting a static file (eg /ror/public/  
check.txt). is that accurate? similarly, if i have a long running  
request on rails, the mutex should have the one thread locked but  
allow requests for non-rails dispacted request (eg static files).

thanks…gg

---

<div class="post-metadata">

**Author:** ![buddy12lbcat](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/cab0a1/32.png) [@buddy12lbcat](https://www.ruby-forum.com/u/buddy12lbcat)\
**Post date:** [October 6, 2009, 1:28am UTC](https://www.ruby-forum.com/t/mongrel-static-files-and-haproxy-healtchecks/176664/2 "2009-10-06T01:28:02Z")

</div>

further investigation leads me to think this is true. i can make my  
app sleep for 60 seconds and i don’t get  
it marked as down or show missed health checks in haproxy. the one  
caveat is that if i delete the check.txt  
from my public directory then i get missing file check.txt in my rails  
production logs (whereas i don’t see  
anything in the production logs if check.txt is present). so i assume  
then that, on not finding a static file,  
mongrel passes it back to rails routing. so my solution is to replace  
my empty check.txt with a check.txt  
that contains a 404 header. that should keep my checks out of rails  
logs and threads.

while this is an imperfect solution as it could be that mongrel is up  
but rails is broken, but given the alternative  
of having to do very infrequent checking to not interfere with normal  
traffic, this seems preferable.

i would, of course, appreciate any feedback or comments.

thanks…gg
