mod_rails blocking processes?

I'm not really sure how mod_rails / passenger works but it's producing some strange behavior for me.

I wrote a simple controller action that sleeps for 5 seconds before returning the current time. I then called that action from two different computers. It took 5 seconds for the first request to finish processing and 10 seconds for the second one. That is, the second request was blocked from executing until after the first one had been finished.

Why does this happen? When I call ps on the server, I see that several ruby and apache processes have been spawned. If the ruby process servicing the first request is busy, when I send the second request to the server, shouldn't it spawn or use a different process instead of waiting for the first one to finish?

-- Andrew

I can't seem to reproduce this. I have this in my controller:

  def aaa     sleep 5     render :text => 'aaa'   end

I followed your steps. Both requests finish in 5 seconds.

Hrmmm ... so after restarting Apache, I've had trouble reproducing the issue as well. Any idea what that might have been?

-- Andrew

Another mod_rails question: Are global variables shared between each ruby process?

No. Each process has its own private memory.