feat: Upper bound on outgoing inflight publishes#615
Merged
yatinmaan merged 1 commit intobytebeamio:mainfrom May 12, 2023
Merged
feat: Upper bound on outgoing inflight publishes#615yatinmaan merged 1 commit intobytebeamio:mainfrom
yatinmaan merged 1 commit intobytebeamio:mainfrom
Conversation
9ca908a to
5f8f15a
Compare
Adds a configuration option for setting an optional upper bound on the number of maximum outgoing publishes. The smaller of this and the value received from the broker on connect is used. This allows the user to limit the memory usage of the client, especially if they have a good idea of the number of inflight messages they expect. The `outgoing_pub` vector accounts for some ~1.5MB of memory, which can be considerable depending on use.
5f8f15a to
de5629a
Compare
Contributor
|
Thanks for your contribution 🚀 |
carlocorradini
pushed a commit
to carlocorradini/rumqtt
that referenced
this pull request
Aug 3, 2023
Adds a configuration option for setting an optional upper bound on the number of maximum outgoing publishes. The smaller of this and the value received from the broker on connect is used. This allows the user to limit the memory usage of the client, especially if they have a good idea of the number of inflight messages they expect. The `outgoing_pub` vector accounts for some ~1.5MB of memory, which can be considerable depending on use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a configuration option for setting an optional upper bound on the number of maximum outgoing publishes. The smaller of this and the value received from the broker on connect is used.
This allows the user to limit the memory usage of the client, especially if they have a good idea of the number of inflight messages they expect.
The background for this is that we run a number of clients that never actually publish anything, just subscribe, and noticed a major bump in memory usage even for idle clients with 0.21.0. The
outgoing_pubvector can be as much as ~1.5MB of memory, which quickly adds up.The solution is fairly simple. Respect the
receive_maxvalue received from the broker, but let users specify an upper bound. This upper bound can safely be used to limit the length of theoutgoing_pubandoutgoing_relvectors, much like it used to work, and how it is done for MQTT3.There is also a comment mentioning resizing the
outgoing_pubandoutgoing_relvectors depending on thereceive_maxvalue from the broker. That could be a separate but related improvement along similar lines.Type of change
New feature (non-breaking change which adds functionality)
Checklist:
cargo fmtCHANGELOG.mdif its relevant of user of the library. If its not relevant mention why.