How to set a time-limit for mongrel?

Hi,

we have a problem with a small-sized Rails application. It is
currently in productive use, and sometimes the customer reports
unavailability of the application.

Today I could watch one of these occasions live and connect to the
server while the application was down. Both mongrel servers were using
100% cpu and a wast amout of memory, they seemed to be blocked by some
large operation (probably a bug in some report generating
functionality of the application)

I don't see any chance to fix the bug soon, so my question is, how can
I set a time-limit on those mongrel servers?

The configuration:
- Linux Debian
- Apache mod_proxy
- 2 Mongrel servers

Somehow mongrel should be restarted, when one request takes more time
than 1 minute. I don't see a way to do this. Any help would be greatly
appreciated.

- Andi

I don't see any chance to fix the bug soon, so my question is, how can
I set a time-limit on those mongrel servers?

I don't have the answer, so this isn't a very helpful post! Back in my
.asp days, we'd set a Server.Timeout to a given number of seconds.
This sort of thing would work for you.

On mongrel.rubyforge.org, there's some stuff about "Ability to specify
a timeout throttling setting and a max number of concurrent
connections with additional attempts at cleaning dead threads out".

  1. Look at your code. Find out what’s causing the mongrels to misbehave. More often than not it’s a code problem.

  2. Are you using RMagick? That’s caused me some problems.

  3. Use Monit. There are some great resources for mongrel + monit. You can use monit to stop / restart mongrels after various conditions occur.

http://www.igvita.com/blog/2006/11/07/monit-makes-mongrel-play-nice/

http://software.pmade.com/blogs/ramblings/2006/12/27/mongrel-cluster-and-monit

Thanks for your answers.

I will try monit, it sounds promising.