I am running an application server using the Play! Framework, which uses Netty for the actual IO heavy lifting.
The HTTP connections have keep-alive turned on (which is the default for HTTP 1.1), and I'm happy with this. However, I would like these kept-alive connections to time out after a certain amount of inactivity (e.g. 15 seconds). As I understand it, this would involve the server closing the connection actively.
This seems like a standard config option, and indeed there is such a setting for Apache. However, I can't see any way to do this in Netty/Play. It seems like the connections stay open until either the client closes them, or the socket times out at the OS level (about two hours).
Is this functionality supported out of the box? And if not, is it feasible to implement by hand (in particular, how do I know when a Channel was last used, or even if it's in use right now)?
You can put IdleStateHandler in the application pipeline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With