Hi,
I'm working on the development of an open source application, GeoServer,
implementing the Web Map Service specification.
The specification allows a client to request maps using simple GET
requests like:

http://sigma.openplans.org:8080/geoserver/wms?WIDTH=431&SRS=EPSG%3A4326&LAYERS=tiger-ny&HEIGHT=550&STYLES=&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=-74.01697805908182,40.69808217724622,-73.99567744140603,40.72526393994153

and the client gets back a PNG with a map of the request area.
No asynchronism is allowed, the protocol is standardized
(http://portal.opengeospatial.org/files/?artifact_id=1058) and I have no
controls over the clients (there are tens of them around, both open source
and proprietary) which are free to make as many request as they like, in
whatever order the like.

By spec we're forced to use a plain request and response approach, but
we're experiencing a problem with clients making lots of request as the
user zooms/pans around: basically a request is made, but the user keeps
on moving, the client drops the older requests (closing the connection in
face of
the server) and makes others.
Unfortunately in the meantime the older requests are still running, drawing
a map takes
time and a lot of memory, for example the above request, which is a
small one btw, allocates a BufferedImage of 700KB. The memory is
consumed up until the image is encoded out to the stream, which is also
the moment we finally figure out the client dropped the connection
(since writing to the servlet output stream fails).

This is very sub-optimal. Servers like Apache with cgi do kill the cgi
process the moment the connection is dropped, significantly reducing the
server load both in terms of CPU and memory consumption.

Is there any way to check if the client connection is still open using
only the standard servlet API?
If not, is there any Tomcat specific approach that might work instead?

If there is no solution that can be applied at the general servlet
api level, do you know of any Tomcat specific approach one could use?
e.g., casting the HttpServletResponse to some Tomcat specific class
and get some connection information status there?

Cheers
Andrea 
-- 
View this message in context: 
http://www.nabble.com/How-to-check-if-the-client-dropped-the-connection-tp25641481p25641481.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to