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

[Feature] The CLI adds a -L parameter to limit message size in the bench command #1360

Closed
ysfscream opened this issue Jul 17, 2023 · 2 comments
Assignees
Labels
CLI MQTTX CLI feature This pr is a feature
Milestone

Comments

@ysfscream
Copy link
Member

ysfscream commented Jul 17, 2023

Ref: https://github.com/emqx/emqtt-bench

Image

Motivation

In the current version of MQTTX, when running the Publish Benchmark, users can run the mqttx bench pub command and define various parameters such as the number of clients and topics. However, there is no way to limit the number of published messages. This can lead to uncontrolled message flow and potential system overload. Users may be frustrated by the lack of control over the number of messages they are publishing.

Detailed design

To resolve this issue, I propose the addition of a -L (--limit) parameter for the "mqttx bench pub" command. This parameter will allow users to set a maximum limit for the number of published messages. Here is how it would look:

Parameter Description Default
-L, --limit The maximum number of messages to publish. A value of 0 means no limit on the number of messages. 0

If the --limit parameter is set to a value greater than 0, the command will publish up to the defined number of messages. If it's set to 0, there will be no limit to the number of messages published.

Example of use:

Command:

mqttx bench pub -c 5000 -t bench/%i -L 1000

Explanation: This command publishes data with MQTTX Bench where:

  • -c 5000 means that it uses 5000 clients,
  • -t bench/%i is the topic to which data is published,
  • -L 1000 limits the number of published messages to 1000.

Result:

The MQTTX Bench will publish up to 1000 messages to the topic bench/%i using 5000 clients. If the data to be published exceeds 1000 messages, it will stop sending further messages.

Alternatives

An alternative approach could be implementing a global setting for message limits that would apply to all "mqttx bench pub" commands. However, this would limit the flexibility of the command and may not be suitable for all use cases. Another alternative could be to ignore this feature, leading to issues with system overloads and reduced performance.

More detail (optional)

This feature requires modifications in how the "mqttx bench pub" command is implemented. It would need to consider the new --limit parameter and adjust the message publishing process accordingly.

Here's a simple flow diagram for better understanding:

Start -> Check if --limit > 0 -> If True, Limit the number of messages to --limit -> Continuously publish messages -> End
                                     |      
                                     -> If False, No limit on the number of messages -> Continuously publish messages

This feature enhances the control users have over their message flow, providing a more efficient and manageable way of using MQTTX.

@ysfscream ysfscream added this to the v1.9.5 milestone Jul 17, 2023
@ysfscream ysfscream added feature This pr is a feature CLI MQTTX CLI labels Jul 17, 2023
@ysfscream ysfscream changed the title The CLI now has a -L parameter to limit message size. [Feature] The CLI now has a -L parameter to limit message size. Jul 17, 2023
@ysfscream ysfscream changed the title [Feature] The CLI now has a -L parameter to limit message size. [Feature] The CLI adds a -L parameter to limit message size. Jul 17, 2023
@ysfscream ysfscream changed the title [Feature] The CLI adds a -L parameter to limit message size. [Feature] The CLI adds a -L parameter to limit message size in the bench command Jul 17, 2023
@ysfscream
Copy link
Member Author

ysfscream commented Jul 17, 2023

Actions:

  • Update docs

@ysfscream ysfscream modified the milestones: v1.9.5, v1.9.6 Jul 18, 2023
@ysfscream ysfscream modified the milestones: v1.9.6, v1.9.7 Sep 4, 2023
@ysfscream ysfscream modified the milestones: v1.9.7, v1.9.8 Dec 8, 2023
@ysfscream ysfscream modified the milestones: v1.9.8, v1.9.9 Dec 28, 2023
@ysfscream ysfscream reopened this Feb 5, 2024
@ysfscream
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI MQTTX CLI feature This pr is a feature
Projects
Status: Done
Development

No branches or pull requests

3 participants