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

initial implementation #1

Merged
merged 2 commits into from
Jan 17, 2024
Merged

initial implementation #1

merged 2 commits into from
Jan 17, 2024

Conversation

levb
Copy link
Collaborator

@levb levb commented Dec 5, 2023

Copy link

@mprimi mprimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very quick look and i don't have a lot of context on this project, but LGTM.

(I would like to see the nats-server branch that this will work with)

shell: bash --noprofile --norc -x -eo pipefail {0}
run: |
cd go/src/github.com/nats-io/nats-server
go test -v --run='-' --bench 'MQTTEx' --benchtime=100x ./server | tee /tmp/current-bench-result.txt
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a test inside nats-server that relies on an external CLI tool (this repository)?

(maybe to avoid extra MQTT dependencies in server?)

Copy link
Collaborator Author

@levb levb Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly, see nats-io/nats-server#4821

But it can also be ran standalone of course, against a production server for example.

@levb
Copy link
Collaborator Author

levb commented Jan 17, 2024

Going to merge this, so I can update the server PR with the @latest reference

@levb levb merged commit 4dd571c into main Jan 17, 2024
2 checks passed
derekcollison added a commit to nats-io/nats-server that referenced this pull request Feb 6, 2024
This PR adds a number of MQTT-specific benchmarks, executed with an
external test client (see
ConnectEverything/mqtt-test#1). This came out of
my work on MQTT message delivery issues in 2.10, and is now packaged as
a `go test --bench`, and added to CI.

The test client uses the Eclipse `paho` library, and can be executed
standalone, pointed at an MQTT server. It measures the timing of its
operations, and outputs it as JSON of reportable metrics.

The benchmarks here run the client, and report back the metrics it
outputs. Memory allocations are measured server-only.

Github action `benchmark` is used to compare the benchmark results to
the base ref of the PR, or the prior result in a branch. If it fails a
120% threshold, the failure is reported as a comment on the commit(!),
and the build fails.

To measure the effect of parallel-fetching retained messages (`SUBRET`),
added `disable_retained_message_cache` MQTT option to the server.

The following benchmarks are run, covering standalone/cluster, QOS,
message sizes to 100K, as well as concurrent clients.
- `PUB` measures just publishing
- `PUBRET` measures publishing with the retained flag on
- `PUBSUB` measures message delivery times from publisher to subscriber
- `SUBRET` measures delivery of 100* retained messages to new
subscriptions

Example of a failure (I rolled back the retained message "fanout"
commit):
<img width="876" alt="image"
src="https://github.com/nats-io/nats-server/assets/1187448/c56eb408-4e4a-4562-ab41-9c024b09ba47">
if you click on the comment link, you get:
<img width="1025" alt="image"
src="https://github.com/nats-io/nats-server/assets/1187448/2b677bb5-8445-4ed0-af5b-bf8519d42f9f">

###### TODO
- `CON` measure CONNECT to CONNACK, with stored sessions
- `SUB`  measuring SUBSCRIBE to SUBACK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants