-excessive client timeouts tied to NIO select(timeout)
Brian Tarbox 2013-02-26, 17:15
The main client loop involves sending keep-alive pings in-between calls to
the NIO selector.select call which looks for data from the server
(including ping responses).
What I've found is that the select() which takes a timeout value takes a
hugely varying time to complete.
When asking for a max 6 second timeout on the select call I'm in fact
staying in the call for 15-25 seconds. Which leads to starving the keep
alives which leads to timeouts.
Looking at the NIO documentation of the timeout parameter to select it says:
timeout - If positive, block for up to timeout milliseconds, *more or less*
Has anyone else seen this or have a suggestion for a work around? This
seems like a basic flaw. If I can't count on timely return from select it
seems to break the how keep-alive scheme.
Thanks in advance for any help!
Camille Fournier 2013-02-26, 18:24
Brian Tarbox 2013-02-26, 18:53