users@glassfish.java.net

Re: Grizzly timeout/hanging?

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 08 Jul 2008 11:39:45 -0400

Salut,

glassfish_at_javadesktop.org wrote:
> Hi
>
> I got a web application with a session bean that does some serious work on a database.
>
> The calculations done in the bean can take more than an hour to process, which btw is okay!
>
> The hurdle is that at some point my jsf page calling the bean seem to loose contact with the bean.
> After an hour, I can see in my database that the bean has finished doing its work there, but the page calling it never returns. It just keep hanging, waiting for the return page.
>
> So my question is whats going on for grizzly? I guess it is some kind of timeout/small bug... How do I fix this? (without optimizing on my bean ;-) )
>

The problem with your scenario is all the Grizzly WorkerThread are
locked by your "serious work on a database" :-) When all the threads are
busy working, Grizzly place request into its queue, waiting for one
WorkerThread to be available.

Three solutions:

(1) Increase the number of Threads and make sure you have less Threads
used when doing your database stuff. This is far from perfect and you
might ends upo in the same situation.

(2) Write a Valve[1] and inside the Valve, make sure you refuse some
requests if you know that all your thread will be blocked by the
database work/pool.

(3) Uses Grizzly RCM[1] to allocate a Thread pool for request to the
database, and another Thread pool for normal request. That way your
database works will never "block" other requests because those requests
will be serviced by another Thread pool (another set of WorkerThread).

Hope that help

-- Jeanfrancois

[1]http://weblogs.java.net/blog/jfarcand/archive/2006/09/extending_glass.html
[2]http://weblogs.java.net/blog/jfarcand/archive/2007/06/improving_ajax_1.html



> Cheers, The SlingBlade
> [Message sent by forum member 'slingblade' (slingblade)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284940
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>