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

On May 2, 9:55 am, Andrew F. [email protected] wrote:

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?

On May 2, 2:50 pm, Andrew F. [email protected] wrote:

Anothermod_railsquestion: Are global variables shared between each
ruby process?

No. Each process has its own private memory.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs