Lars Pind

internet software, coaching, and entrepreneurship

Lars Pind - internet software, coaching, and entrepreneurship
Check out Coach TV, my video blog on happiness and personal development for geeks.

How to not lose requests when using Mongrel with Pen

April 20, 2007 · See comments

I use lighttpd + pen + Mongrel to serve most of my Rails apps, and so far, I’ve been serving a blank screen to some people after having deployed a new release, and I wasn’t sure why. For some reason I thought the problem was with Mongrel, until I realized that it was probably with pen.

My theory is that when pen tries to serve a request, it notices that all of the backends are suddenly dead, so it serves a blank page. But it also ban the backend process for 30 seconds, so even though it only takes a few for the backends to come back up, they’re now all banned for 30 seconds.

The trick is to add the following two command line parameters: -b 5 -t 10.

What that does is tell pen to only ban a backend for 5 seconds, and to not time out requests for 10 seconds, leaving the Mongrels plenty of time to come back up.

blog comments powered by Disqus

Comments ↓

  • 1 Jeremy // Apr 21, 2007 at 06:17 PM

    Wow thanks! I'm a regular reader and enjoy your work. Keep it up!