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

MF-295 add mqtt benchmark tool #817

Merged
merged 27 commits into from
Aug 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
122 changes: 122 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@
[prune]
go-tests = true
unused-packages = true

[[constraint]]
revision = "ced62fe5104b907b6c16cb7e575c17b2e62ceddd"
name = "gonum.org/v1/gonum"
70 changes: 70 additions & 0 deletions tools/mqtt-bench/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# MQTT benchmarking tool

A simple MQTT (broker) benchmarking tool for Mainflux platform. ( based on github.com/krylovsk/mqtt-benchmark )


The tool supports multiple concurrent clients, publishers and subscribers configurable message size, etc:

```
cd benchmark
go build -o mqtt-benchmark *.go

> mqtt-benchmark --help
Usage of mqtt-benchmark:
-broker="tcp://localhost:1883": MQTT broker endpoint as scheme://host:port
-clients=10: Number of clients to start
-count=100: Number of messages to send per client
-format="text": Output format: text|json
-password="": MQTT password (empty if auth disabled)
-qos=1: QoS for published messages
-quiet=false : Suppress logs while running (except errors and the result)
-size=100: Size of the messages payload (bytes
-subs=10 number of subscribers
-pubs=10 number of publishers
-config=connections.json , file with mainflux channels
-mtls=false, use mtls
-ca=ca.crt, use mqtts, pass ca to server validate certificate
```

Two output formats supported: human-readable plain text and JSON.

Before use you need a channels.toml you can use tools/provision/main.go to create
channels for testing

Example use and output:

```
go build -o mqtt-benchmark *.go

without mtls
./mqtt-benchmark --broker tcp://localhost:1883 --count 100 --size 100 --qos 0 --format text --subs 100 --pubs 0 --channels channels.toml

with mtls
./mqtt-benchmark --broker tcps://localhost:8883 --count 100 --size 100 --qos 0 --format text --subs 100 --pubs 0 --channels channels.toml --mtls -ca ca.crt
```


You can use config.toml to create tests with this tool
./mqtt-benchmark --config config.toml it will read params from config.toml


```
broker_url = "tcp://localhost:1883"
qos = 2
message_size =100
message_count =100
publishers_num =3
subscribers_num =1
format = "text"
quiet = true
mtls = false
skiptlsver = true
ca_file = "ca.crt"
channels_file = "channels.toml"
```

For Example

```
./mqtt-benchmark --config tests/fanin.toml
```
Loading