[jdev] XMPP Ping method?

Dave Cridland dave at cridland.net
Fri Nov 3 04:34:26 CST 2006

On Thu Nov  2 23:24:47 2006, Jesus Cea wrote:
> I'm a bit worried about CPU/bandwidth explosión, nevertheless. And
> mobile bandwidth, that pay per byte.

Also on mobile, the battery drain for transmission outweighs 
everything else. The battery drain for receiving data isn't small 
either. In practise, this means three things:

1) You only generally want to send data when you absolutely have to.

2) You only want to send extra data when you're sending some already.

3) You don't want to recive data you don't need, either.

So for keeping a connection live, whitespace is good - it's a single 
octet, which translates as about 40 bytes or so including the TCP 
overhead. On most mobile networks, you'd be needing to send these 
every N minutes, where N is around 4. Every one of those bytes you 
send, you pay for.

For ACKs and restarts, you either want to wrap a sequence number into 
the TLE, or you want to append a new TLE to the end of each TCP 
packet. The ACK that comes back shouldn't be sent immediately, either 
- it should be safe to hang onto until the server *needs* to send 
something, or - for client ACKs to the server - you're going to send 

So a rough logic is that if the connection has been quiet for 4 
minutes, the client sends an ACK if one is outstanding, or else you 
send a whitespace character. Ideally, we'd have the server send the 
whitespace pings, because they cost the device less in terms of 
battery. I imagine we'd use a stream feature for this negotiation, in 
which case the ACKs themselves might as well be a new TLE.

Incidentally, the power concerns are true to a reasonable degree for 
WLAN, too, so this isn't a purely mobile thing.

Dave Cridland - mailto:dave at cridland.net - xmpp:dwd at jabber.org
  - acap://acap.dave.cridland.net/byowner/user/dwd/bookmarks/
  - http://dave.cridland.net/
Infotrope Polymer - ACAP, IMAP, ESMTP, and Lemonade

More information about the JDev mailing list