You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shravan Shashikant <s0...@unix.tamu.edu> on 2001/04/23 10:13:18 UTC

Timeout issue

Hi there,
   I have a problem with a certain servlet code of mine which takes a lot
of time to execute.The problem is that since it takes a lot of time to
execute,the browser times out the servlet after say 5 minutes.I heard
somewhere that this can be remedied by using out.flush() for the output
stream;that didnt work and i learnt later that the problem is actually
with Apache which buffers output in 8k units.I was wondering whether this
setting could be changed or if there were any other solution to this
problem.I looked at certain threading issues but am generally
uncomfortable using the meta header and refreshing it every 10
seconds,till the thread of the task is completed.
  Also,found out that we can increase the timeout for the apache web
server by changing the httpd.conf file.But is there anyway to reduce the
output buffer size?
Thanks & Regards,
Shravan


Re: Timeout issue

Posted by Jon Barber <jo...@acm.org>.
On Monday 23 April 2001 09:05, Endre Stølsvik wrote:
> Basically different threads, differnt stacks.. Each thread is executing
> the function with it's own little "memory-space", and thus each users have
> their own rendering of the servlet. But if you use class fields
> (variables) you'll get that "problem" (or feature, depends on what you
> want)..


Using the HttpSession cache guarantee's that each user just gets the feedback 
appropriate for themselves.

Check out Jason Hunters book on Sevlets, as he ahs a good example calulating 
primes in the background, but this is visible to all users.

Jon.

Re: Timeout issue

Posted by Endre Stølsvik <En...@Stolsvik.com>.
On Mon, 23 Apr 2001, Shravan Shashikant wrote:

| I had a doubt over here.How do you handle multiple users accessing the
| same servlet of yours.I mean,at the same time if 2/more users access
| your servlet and consider for a moment that,what one person requires
| to be done from the servlet is different from what the other person
| wants.basically if the parameters are different,i dont see how you can
| handle multiple users accessing the servlet and being provided the
| results they asked for.

Basically different threads, differnt stacks.. Each thread is executing
the function with it's own little "memory-space", and thus each users have
their own rendering of the servlet. But if you use class fields
(variables) you'll get that "problem" (or feature, depends on what you
want)..

-- 
Mvh,
Endre



Re: Timeout issue

Posted by Shravan Shashikant <s0...@unix.tamu.edu>.
Thanks Jon,
  Well,I guess thats pretty much the only option unless I get the Apache
source code and make the changes and compile it!..I had a doubt over
here.How do you handle multiple users accessing the same servlet of
yours.I mean,at the same time if 2/more  users access your servlet and
consider for a moment that,what one person requires to be done from the
servlet is different from what the other person wants.basically if the
parameters are different,i dont see how you can handle multiple users
accessing the servlet and being provided the results they asked
for.Probably there is a way,but I'm ignorant here and would like to know
if and how its possible.
Regards,
Shravan

On Mon, 23 Apr 2001, Jon Barber wrote:

> Hi Shravan,
> 
> I've recently had the same situation and we solved it thus :
> 
> Encapsulate the lengthy process in an object that implements Runnable, 
> complete with an isFinished() call.  Start a seperate thread to execute this 
> and place the object in the httpsession.  Send a page back to the user with, 
> say, a 5 second refresh which updates the user on the status of the process.
> 
> It's not ideal, as it is a form of polling, but it gives the opportunity for 
> user feedback.  We cached the last 5 processing times and could give an ETA 
> to the user based on the mean.
> 
> 
> Jon.
> 
> On Monday 23 April 2001 08:13, Shravan Shashikant wrote:
> > Hi there,
> >    I have a problem with a certain servlet code of mine which takes a lot
> > of time to execute.The problem is that since it takes a lot of time to
> > execute,the browser times out the servlet after say 5 minutes.I heard
> > somewhere that this can be remedied by using out.flush() for the output
> > stream;that didnt work and i learnt later that the problem is actually
> > with Apache which buffers output in 8k units.I was wondering whether this
> > setting could be changed or if there were any other solution to this
> > problem.I looked at certain threading issues but am generally
> > uncomfortable using the meta header and refreshing it every 10
> > seconds,till the thread of the task is completed.
> >   Also,found out that we can increase the timeout for the apache web
> > server by changing the httpd.conf file.But is there anyway to reduce the
> > output buffer size?
> > Thanks & Regards,
> > Shravan
> 


Re: Timeout issue

Posted by Jon Barber <jo...@acm.org>.
Hi Shravan,

I've recently had the same situation and we solved it thus :

Encapsulate the lengthy process in an object that implements Runnable, 
complete with an isFinished() call.  Start a seperate thread to execute this 
and place the object in the httpsession.  Send a page back to the user with, 
say, a 5 second refresh which updates the user on the status of the process.

It's not ideal, as it is a form of polling, but it gives the opportunity for 
user feedback.  We cached the last 5 processing times and could give an ETA 
to the user based on the mean.


Jon.

On Monday 23 April 2001 08:13, Shravan Shashikant wrote:
> Hi there,
>    I have a problem with a certain servlet code of mine which takes a lot
> of time to execute.The problem is that since it takes a lot of time to
> execute,the browser times out the servlet after say 5 minutes.I heard
> somewhere that this can be remedied by using out.flush() for the output
> stream;that didnt work and i learnt later that the problem is actually
> with Apache which buffers output in 8k units.I was wondering whether this
> setting could be changed or if there were any other solution to this
> problem.I looked at certain threading issues but am generally
> uncomfortable using the meta header and refreshing it every 10
> seconds,till the thread of the task is completed.
>   Also,found out that we can increase the timeout for the apache web
> server by changing the httpd.conf file.But is there anyway to reduce the
> output buffer size?
> Thanks & Regards,
> Shravan