On Thu Apr 30 21:09:39 2009, Jonathan Schleifer wrote:
Dave, are you sure sending pings for keepalive is a good idea? This
generates a lot of traffic for mobile devices. Normally, a TCP
keepalive or - if not available - sending a space should be sufficient.


We use TCP keepalives in our IMAP product, M-Box, which is heavily geared toward (and heavily used by) the mobile email industry, and we've a number of issues with them, not least they're insufficiently controllable in most operating systems, hence we moved to untagged OK responses, instead. The size difference between a TCP keepalive packet and an untagged OK isn't actually that much, and all operating systems allow precise control of when we send the latter, of course.

With XMPP, XEP-0199 provided a much cleaner option, but we only use these after a reasonably lengthy time has elapsed with nothing at all from the remote end - about five minutes, in fact - and even then, we send two, one minute apart, and timeout only when the first is outstanding by over two minutes.

We also use whitespace more frequently in order to (attempt to) defeat NATs, however several mobile networks appear to have vastly increased NAT timeout, as well as survivability of TCP sessions for out-of-range devices, so I'm strongly considering a corresponding increase in timeouts.

So we're using XEP-0199 explicitly to provoke clients into a response, to ensure they're still actually present, and that only after they've been silent long enough for us to consider the possibility they're actually ghosts.

By way of completeness, incidentally:

1) The operating system gives no feedback from the result of a TCP keepalive operation, and indeed doesn't tell you they've even occured.

2) In the mobile environment, where this is particularly needed, things are even less useful, since the GSM gateways can, and often do, acknowledge data even if the handset is out of range, so the keepalive actvity never goes across the air, and never tells you anything useful (even if the OS would tell you).

IMO, pinging should be used to get to know the latency, not as a
keepalive.

Well, we're absolutely not using them as a keepalive, we're using them as a connectivity probe, which I think is an entirely reasonable usage, and arguably much better usage than latency measurement.

Dave.
--
Dave Cridland - mailto:[email protected] - xmpp:[email protected]
 - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
 - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade

Reply via email to