tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Is it possible to send a 'keep-alive' packet back to client session every x seconds?
Date Thu, 27 Mar 2014 11:07:09 GMT
Mark Thomas wrote:
> On 27/03/2014 03:08, Matthew Turany wrote:
>> Is it possible to configure either apache or tomcat to send a packet every
>> x number of seconds so that at the client end the gateway thinks the
>> session is still active and will keep the connection open, or is this
>> something best put into the actual web app?
> socket_keepalive
> You'll need to configure the OS to send the packets frequently enough.

That's a bit the hammer, isn't it ? Under Linux at least, this seems to be a global kernel

setting, so it applies to all connections.

> Alternatively, change the application design:
> - One request to trigger generation of the report
> - N requests to retrieve report which returns either "still processing"
> (maybe with an ETA) or "here it is".

Apart from any gateways/proxies/firewalls, there is also a browser timeout : if the 
browser sends a request, and then does not get a response for 4-5 minutes, eventually it 
will time-out, close the connection, and display "the server is not responding.. try again


Another possibility is to have the application periodically send some kind of "partial 
response" to the browser (e.g., a line of ".."), to be replaced by the real response when

it's ready.  It's a 20-year old trick, and it is a bit tricky to get right, but it still 
works.  Of course it means that the application has to be able to do that, and is not 
itself waiting on a call to a slow external resource.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message