Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backoff strategy for the built-in bridge #2899

Closed
reubenmiller opened this issue May 24, 2024 · 5 comments
Closed

backoff strategy for the built-in bridge #2899

reubenmiller opened this issue May 24, 2024 · 5 comments
Assignees
Labels
idea ideas/opportunities/feature requests which need to be further investigated before implementation theme:mqtt Theme: mqtt and mosquitto related topics
Milestone

Comments

@reubenmiller
Copy link
Contributor

Is your feature request related to a problem? Please describe.

thin-edge.io should be a first good citizen when it comes to connecting to an external MQTT broker. It should implement reasonable backoff algorithms so that if the external MQTT becomes overloaded, it does not cause a "thundering herd" problem but quickly retrying to connect to the broker.

The new in-built MQTT bridge functionality should support a backoff strategy which will avoid such issues.

Describe the solution you'd like

The following backoff strategy is proposed:

  • On each retry, the wait interval should be doubled (with jitter), but cap the max result a configurable value (e.g. 10mins)
  • A minimum wait interval should be enforced (and configurable) to ensure that clients do not try to reconnect to quickly after a failed attempt. Default value should be 30 seconds
  • The wait interval should only be reset to the minimum wait interval after the MQTT connection has been connected for a minimum period (e.g. 5 mins)

Describe alternatives you've considered

Additional context

@reubenmiller reubenmiller added idea ideas/opportunities/feature requests which need to be further investigated before implementation theme:mqtt Theme: mqtt and mosquitto related topics labels May 24, 2024
@reubenmiller
Copy link
Contributor Author

@didier-wenzek @albinsuresh @jarhodes314, we can discuss the specifics in the ticket.

@didier-wenzek
Copy link
Contributor

The proposed strategy is not directly aligned to what is proposed by the backoff crate, but one should be able to make it.

@reubenmiller
Copy link
Contributor Author

The proposed strategy is not directly aligned to what is proposed by the backoff crate, but one should be able to make it.

The linked crate looks good, and I'm sure we can wrap it to utilize the reset logic regarding the "stable connection".

@reubenmiller
Copy link
Contributor Author

See these comments for information about the backoff algorithm (plus jitter).

@gligorisaev
Copy link
Contributor

QA has througly checked the feature and is pleased to confirm that the described is functioning.

@reubenmiller reubenmiller changed the title backoff strategy for the in-built bridge backoff strategy for the built-in bridge Jun 25, 2024
@reubenmiller reubenmiller added this to the 1.2.0 milestone Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idea ideas/opportunities/feature requests which need to be further investigated before implementation theme:mqtt Theme: mqtt and mosquitto related topics
Projects
None yet
Development

No branches or pull requests

4 participants