How to not lose requests when using Mongrel with Pen
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.
About Calvin Correli
I've spent the last 17 years learning, growing, healing, and discovering who I truly am, so that I'm now living every day aligned with my life's purpose.
1 comment
Leave a comment