How to not lose requests when using Mongrel with Pen

20 Apr

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.

One Response to “How to not lose requests when using Mongrel with Pen”

  1. Jeremy 20. Apr, 2007 at 1:28 pm #

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