Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mosquitto-dev] keep-alive in Mosquitto and in MQTT v5/v3.1.1

Hello!

Mosquitto should support a keep alive interval of 0, but, recently (I don't know the exact version) one has to configure it to allow a value of 0.

https://mosquitto.org/man/mosquitto-conf-5.html

See `max_keepalive` parameter


On Mon, Sep 25, 2023 at 5:41 PM Lemburg, Martin via mosquitto-dev <mosquitto-dev@xxxxxxxxxxx> wrote:

Hi Frank,

 

Thanks for your “immediate” response!

 

Sorry, I was too unspecific in my question.

 

If I understood it correctly, a keep-alive value of zero, would switch off the broker-sided test for receiving PINGREQ packets to decide, if a connection is alive or should be closed.

 

To switch of the PINGREQ test for connection closure at the broker, the client needs to specify the keep-alive interval to be zero.

But the Mosquitto API allows only a keep-alive interval of five or more seconds.

 

I’m with you and I don’t think, that it mostly makes no sense to specify values lower then five, but zero is valid and as a semantic!

 

That’s why I’m asking.

 

Best regards

Martin

 

From: mosquitto-dev <mosquitto-dev-bounces@xxxxxxxxxxx> On Behalf Of Frank Pagliughi via mosquitto-dev
Sent: Monday, September 25, 2023 4:31 PM
To: mosquitto-dev@xxxxxxxxxxx
Cc: Frank Pagliughi <fpagliughi@xxxxxxxxxxxxxx>
Subject: Re: [mosquitto-dev] keep-alive in Mosquitto and in MQTT v5/v3.1.1

 

Keep in mind that the value of zero for Keep Alive is a special indicator to turn it off (i.e. don't use Keep Alive).

So don't think of the specs as saying you can "go down to zero". Technically, I guess, a 1-sec Keep Alive should be supported, but practically, this would induce a huge overhead on the broker. If you had ten thousand clients pinging at that rate, it would be hitting the broker with 10k msgs/sec just to maintain otherwise quiet connections.

So you will find that many clients won't let you set a Keep Alive of less than 5 or 10, and default to something like 30, 45, or 60.

Whether a _client_ is required to support all values 1-65535 is debatable. Technically, a _broker_ probably should, to be 100% compliant, but allowing really low values would let some clients put a large burden on the broker.

Frank

On 9/25/23 09:06, Lemburg, Martin via mosquitto-dev wrote:

Hello,

 

May be a naive question, but why I can only connect with Mosquitto to a broker with a keep-alive greater or equal to 5, while the protocols allow a zero keep-alive?

 

That’s all for the beginning.

 

Best regards

Martin



_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev

 

_______________________________________________
mosquitto-dev mailing list
mosquitto-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/mosquitto-dev

Back to the top