mongrel allow concurrency.


Does anyone knows how to set concurrency=true for mongrel. For webrick
we can set that in lib/webrick_server.rb at
line 80 :
    REQUEST_MUTEX.lock unless ActionController::Base.allow_concurrency

Is there something similar possible in mongrel, and where?


Hi Shishir

Andreas is right, Rails is single-threaded and that's why the
recommended approach is to use Apache to proxy Rails and handle the
static content in front of a pack of mongrel processes.

- Mongrel serves static files directly, without telling rails anything about it.
- You will need to find rails handler in mongrel source,
rails_handler.rb iirc and disable mutex around request serving part,
and also set ActionController::Base.allow_concurrency = true in your
environment file.
- Don't do it if you don't know what you're doing :slight_smile:
- Have fun.

But in my context the two concurrent requests retrieve dynamic content
from the server and are getting locked because I don't know. Whether
it's because of rails or because of mongrel. :frowning: , badly confused now

SOS !!

No one can say a word without looking at the code :slight_smile:

Serving a static file doesn't keep a mongrel process busy due it's
threaded model, unless of course you're doing it from rails using
send_data/send_file ( which you should never ever do ).

Depends on how many people will be using your site at once. I use
send_data just fine with the software I have written for a small lab.

And also, they have memory leaking related issues.