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.
![](https://active-storage.simplerousercontent.net/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6ODc2MTIzLCJwdXIiOiJibG9iX2lkIn19--1b30a7ab1e3fa62b5fb5ad353b7274fb273c0c93/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJwbmciLCJyZXNpemVfdG9fZmlsbCI6WzUwMCw1MDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--25278945c39e5ac55075c45502d7ee00fa60fa3b/Option%201%20Mint%20Green.png)
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