Nginx reverse proxy + mongrel and fork

Nicky Be lists at
Fri Dec 21 00:07:50 MSK 2007

Hi all,

I originally posted this to the rails deployment list, but then I
noticed the nginx forum, and thought it would be better suited here.

I'm trying to kick off simple (yet long running) background processes
from within my rails app.  I'm using Tom Anderson's spawn plugin to fork a child process and unhook
the active record DB connections to keep rails happy.  Anyway,
everything works great when I hit a mongrel process directly
(http://myapp:3000/controller/action).  The action quickly executes, the
results are returned to my browser, and the child process takes its time
doing the heavy lifting.  I can hit that mongrel process again and
verify that it's free to serve up another request.

Life is good-- that is until, I bring nginx into the mix.  With nginx
proxying to the upstream :3000 mongrel, the response isn't immediately
returned to my browser.  Instead, the rails log file shows that the
request is finished, but my browser continues to spin, waiting for the
response.  If I stop the request, I can load an alternate action to
verify that the lone mongrel is free to serve another request.

Has anyone had success with nginx, mongrel, and child processes?  I just
installed pen to balance the single mongrel, and it worked as expected.

My dev box is intel mac, ruby 1.8.6, mongrel 1.1.2, nginx 0.5.34 (tried
with same results on 0.5.32.)

Posted via

More information about the nginx mailing list