Mongrel allow concurrency

Hi,

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?

~Shishir

Don’t do it. Rails is not thread safe, you will get all kinds of
problems.

Andreas

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.

On Sep 26, 10:13 pm, Andreas S. <rails-mailing-l…@andreas-

  • 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.

On 9/26/07, CCH [email protected] wrote:

Don’t do it. Rails is not thread safe, you will get all kinds of
problems.

Andreas

Posted viahttp://www.ruby-forum.com/.


Cheers!

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 !!

Shishir S. wrote:

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

It’s because one mongrel can only serve one rails request at a time. To
handle multiple requests at the same time you need a mongrel cluster or
a FastCGI/LSAPI setup.

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

On 9/27/07, Shishir S. [email protected] wrote:

  • You will need to find rails handler in mongrel source,

problems.


Cheers!

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 ).

It’s because one mongrel can only serve one rails request at a time. To
handle multiple requests at the same time you need a mongrel cluster or
a FastCGI/LSAPI setup.

Posted via http://www.ruby-forum.com/.


Cheers!

And also, they have memory leaking related issues.

On 9/27/07, Cache22 [email protected] wrote:

handle multiple requests at the same time you need a mongrel cluster or


Cheers!

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.