← Back to team overview

mosquitto-users team mailing list archive

Re: Max connections on a single mosiquitto server

 

On Thu, May 23, 2013 at 10:23:21AM +0800, Neo Qing wrote:
> 3. Client does not send the PINGREQ
> I use nodejs as test client, and mqttjs is my lib, since mqttjs lib will
> send ping message automatically, suppose ping message is sent. Ideally, the
> interval  of ping message  is 1.5 second.
> As well I'd like to know what the best practice on ping interval, it's
> determined by what?  thanks in advance.

keepalive intervals of 1.5secs seem absurdly short to me.  Maybe you have some real need
for that sort of responsiveness, but particularly if you're talking about 100,000s of
clients, then you have a _massive_ amount of packets, doing absolutely nothing at all.
Network latency could push a second in bad environments.  

It's a tradeoff of course, how quickly you would like to be notified that a client has
disconnected (assuming they don't politely disconnect) and the amount of overhead
protocol traffic that you want.

Remember, if you control the clients, and you are trying to deal with instant response of
"your chat partner has left" you can just make sure to actually send the disconnect in
your client.  This way you only need the super short keepalive timer to handle unexpected
disconnections.  Otherwise, 90seconds or something and the amount of traffic drops
through the floor. 


Cheers,
Karl P




References