Jruby On Rails with Tomcat - request blocks application

Hi,

I have application deployed on Tomcat and I need to process long running
request. When I start processing my application becomes blocked. Is
there any way to workaround this situation?

I am taking into consideration using threads but I need to inform user
about request status…

Maybe there is a possibility to tune tomcat or something

Many thanks in advance for any help.

Rgs,
Michal

We run background jobs in threads, and that seems to work great. You
could
also put your requests in a JMS queue to a processor that handles the
jobs.
Typically we write status to a shared resource (e.g. database or file).
You
then expose this resource (rails controller) and poll for the status
with
javascript.

-Justin

When you say the application becomes “blocked” do you mean that it just
takes a long time to process the request and for the user to see a
response
or does your application not handle any more requests at all?

Joe

Justin C. wrote:

We run background jobs in threads, and that seems to work great. You
could
also put your requests in a JMS queue to a processor that handles the
jobs.
Typically we write status to a shared resource (e.g. database or file).
You
then expose this resource (rails controller) and poll for the status
with
javascript.

-Justin

Hi Justin,

Could you please elaborate more about how to inform user when his job is
done? I mean… if you put your job in background you simply end request
(Am I right?). How can I inform browser about job status? My idea was to
run ajax inquiry and try to check status every X seconds.

Many thanks,
M.

Joseph A. wrote:

When you say the application becomes “blocked” do you mean that it just
takes a long time to process the request and for the user to see a
response
or does your application not handle any more requests at all?

Joe

Hi Joe,

Application do not handle any more requests…

Rgs,
Michal

On Mon, Jan 11, 2010 at 4:09 PM, Michal N. [email protected]
wrote:

I have application deployed on Tomcat and I need to process long running
request. When I start processing my application becomes blocked. Is
there any way to workaround this situation?

I am taking into consideration using threads but I need to inform user
about request status…

Maybe there is a possibility to tune tomcat or something

Perhaps you can signal QUIT or send Ctrl+\ to the Tomcat process to
see where it’s blocking? It sounds like either the available threads
in Tomcat’s pool are getting used up or there’s some other resource in
your application being contended for (or acquired and not released).

  • Charlie

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Could you please elaborate more about how to inform user when his job is

done? I mean… if you put your job in background you simply end request

(Am I right?). How can I inform browser about job status? My idea was to
run ajax inquiry and try to check status every X seconds.

Yes, you do end the primary request. However, subsequent ajax requests
are
able to check and report the status. If you’re using prototype.js you
can
use:

new Ajax.PeriodicalUpdater(‘status’, ‘/current_status’,
{
method: ‘get’,
insertion: Insertion.Top,
frequency: 1,
decay: 2
});

See:

http://api.prototypejs.org/ajax/ajax/periodicalupdater.html

-Justin

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