tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <craig...@apache.org>
Subject Re: proxy server time outs
Date Wed, 14 Nov 2001 02:26:55 GMT


On Tue, 13 Nov 2001, Tom Drake wrote:

> Date: Tue, 13 Nov 2001 18:11:04 -0800
> From: Tom Drake <rtd@pobox.com>
> Reply-To: Tomcat Users List <tomcat-user@jakarta.apache.org>,
>      Tom Drake <rtd@pobox.com>
> To: Tomcat Users List <tomcat-user@jakarta.apache.org>
> Subject: Re: proxy server time outs
>
> Depending on the proxy server, there may be a configurable
> time-out.
>
> Your web-application should spit back the HTTP header and
> the beginning of your HTML document before you start the query.
> Make sure to flush the output stream.
>
> If this is not enough, and you are producing an HTML response,
> you could launch a thread in your servlet that
> kicks out a space ' ' to the servlet output stream every so often.
> When your query finally completes, do whatever is necessary
> to stop the thread, then close the output stream and return.
>

One approach that is common on long-running queries is to run them in an
independent thread on the server, and then create an initial response page
that says "Processing ... please wait".  At the top of the page, use a
meta tag to automatically refresh every ten seconds or so.

As each request comes in, the servlet checks if the query is complete yet.
If it's still running, return a "Still processing ..." page.  If it's
done, send the resulting report.

Of course, there are some much better options (IMHO):

* Redesign your application's queries so that they need to gather
  less information at a time, and are thus less prone to timeout.
  If you're having to retrieve 1000 rows for a big report, design
  things so that you can paginate the response 20 rows at a time.
  Users are *much* less likely to cancel and go elsewhere when the
  system is more responsive in this way.

* Work with your database administrator (DBA) to fine-tune the actual
  queries you are using to retrieve information.  I've seen 100x
  (two orders of magnitude) improvements in query response time from
  simple changes in the selection criteria, and/or additions of
  appropriate indexes to the database.

Craig McClanahan


>
> ----- Original Message -----
> From: "Evan Swanson" <Evan.Swanson@gmd.fujitsu.com>
> To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
> Sent: Tuesday, November 13, 2001 5:30 PM
> Subject: proxy server time outs
>
>
> | I have an application that queries a very large database.
> | It takes a long time but there does not seem to be anyway around that.
> | This all works fine until I use it with a proxy server.
> |
> | The proxy server times out because there is such a slow response.
> |
> | Is there any way to tell the proxy server "Hold on, its comming"?
> |
> |
> | --
> | To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> | For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> | Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
> |
> |
> |
>
>
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>
>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message