Hi

I sometimes have some quite long running tasks on a server which I would
like to cancel/stop if the client disconnects
(in case of GET requests, not e.g. POST file uploads). It seems this is not
the case, and that tasks continue to run to
completion. Sometimes users get bored and reload launching another request,
and sometimes they navigate to somewhere
else wasting server resource usage.

I can perhaps use ServletRequestListener.requestDestoryed listener to get
notification of such tasks but what is recommended
approach for stoping the request thread? What about releasing resources
like database connections, file handles or running tasks
(executor service)?

What is the recommended approach in stopping such tasks as soon as possible?

Also, thinking about it for a bit more I realize I don't really know how
servlets interact with browsers using HTTP 1.1 to launch multiple
requests over a single TPC connection. If the protocol details don't allow
for detection of disconnect than it might not be possible
to prevent resource waste.

In such a case it is good to limit the servlet load with some kind of
thread pool for processing such requests, which can at least throttle
the incoming requests. Perhaps even in conjuction with continuations to not
waste thread while processing, though this might not be very
significant with requests beeing so intensive that 10 simultaneous requests
would already tie up a few maching cpus completely.

It wouldn't be bad even to place some kind of high hard limits, on at least
cpu usage, for processing a single request.
Is there some mechanism that could be used for limiting per request
resource usage in jetty?

I am using jetty 7.0.1 if that matters, but upgrade is planned..

Best regards
NB
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to