[ejabberd] s2s and c2s ping/keep-alive and "proper" shutdown

Bruce Fitzsimons Bruce at Fitzsimons.org
Tue Oct 10 13:48:57 MSD 2006

Sergei Golovan wrote:
> On 10/10/06, Bruce Fitzsimons <Bruce at fitzsimons.org> wrote:
>> Peoples,
>> I see that some servers sent empty (1 whitespace) packets to force tcp
>> connections to either stay open (ack) or die (no ack after re-xmits).
>> Also helpful for keeping firewalls alive I guess, but the client can
>> manage that. I think I'd do that for any connection that hadn't had
>> traffic in <config> seconds.
> Sending whitespaces doesn't help much to keep tracking over the TCP
> connection. You still rely on TCP timeouts which are quite long
> (though not 2 hours as with default keep-alive mechanism).
Hmm. I agree. I really like SCTP (in my day job) because of this since
frequent heartbeats are part of the protocol. Closing sockets based on
msiing TCP ACKs may be marginally better timewise (linux quotes
13-30minutes, as standard) but I agree it isn't worth doing unless it is
radically improved.

Reading further into the list I see this has been discussed a lot more,
and without many conclusive results. I'm somewhat stunned that an
application protocol really believed that TCP was reliable end-to-end. I
guess it comes back to the design goals -- is 99.n% reliability
w/blackholing good enough?
> The only (AFAIK) way to ensure that connection is alive is to send
> some packet for which client issue a reply. XMPP doesn't define this
> acknowledgment protocol, but it would be much better from the
> reliability point of view if all packets were acknowledged in some
> way.
Yes. JEP/XEP-22 does sort of define this, but at quite a cost (client
impl, and network bandwidth). It also isn't really designed as an
ack/resend type thing, just a friendly status report that itself is
unreliable :-)

Okay, so I'll have more of a think about this. The tcp queue length vs
sent bytes thing (
) could be done in erlang (under linux at least, breaking
multi-platform). This would give more reliability, but not absolute
reliability. s2s in SCTP would be great, even if not standardised, I
wonder when that SCTP impl will make it into OTP?


More information about the ejabberd mailing list