Ajax and performance


#1

Hello,

I got this newbye problem :

1 method is very long to process and CPU consuming.
So, i want to add a progress bar.

But when i call this heavy method, then the entire rails application is
frozen until it finished.
So the ajax call for progression status does not get any response from
the server until the method is finished…

I tryed with Webrick and Apache + mod_scgi with the same result.

Is there a way to make it multi thread to process multiple requests in
the same time ?
Does i have to create a cluster or a kind of ruby worker pool to handle
several requests in the same time ?
Is there a way to ‘renice’ a method ?

Am i missing somethings ?

Any ideas is welcome :slight_smile:

Thank you in advance


#2

Rails is not thread safe so your choices are multiple web server
processes or use of something like http://backgroundrb.rubyforge.org/

Michael


#3

MichaelLatta wrote:

Rails is not thread safe so your choices are multiple web server
processes or use of something like http://backgroundrb.rubyforge.org/

Michael

Thank you Michael,

Will Rails be thread safe one day ?
This basic feature is really missing to me…
py