Mainflux.mainflux/tools/mqtt-bench
Ivan Milošević cddfdf4038
NOISSUE - Use github action for showing OpenAPI spec with Swagger UI (#1427)
* init swaggerui action

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* remove dep

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* fix filename

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* add checkout master

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* try diffrent action

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* change path for search

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* change path

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* change path

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* put almost all openapi spec to one folder

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* fix pattern

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* try servers changing

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* test k8s

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* remove servers

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* use blokovi action

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* add cname

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* Parameters ready for PR to upstream

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* Fix errors in Auth openapi spec

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* remove white line

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* fix link in README

Signed-off-by: Ivan Milosevic <iva@blokovi.com>

* change docs and api links in readme files

Signed-off-by: Ivan Milosevic <iva@blokovi.com>
2021-06-23 13:31:46 +02:00
..
cmd NOISSUE - Use github action for showing OpenAPI spec with Swagger UI (#1427) 2021-06-23 13:31:46 +02:00
scripts NOISSUE - update mqtt benchmark (#824) 2019-08-27 14:21:39 +02:00
templates NOISSUE - Simplify MQTT benchmarking tool (#852) 2019-09-25 19:02:29 +02:00
.gitignore NOISSUE - Clean NginX files, move .gitignores to dirs (#853) 2019-09-16 11:47:34 +02:00
Makefile NOISSUE - Improve MQTT benchmarking tools (#828) 2019-08-30 14:09:12 +02:00
README.md NOISSUE - Use github action for showing OpenAPI spec with Swagger UI (#1427) 2021-06-23 13:31:46 +02:00
bench.go MF-1378 - Update dependencies (#1379) 2021-05-20 20:53:56 +02:00
client.go Fix provision tool connect error handling (#879) 2019-10-08 19:31:13 +02:00
config.go NOISSUE - Simplify MQTT benchmarking tool (#852) 2019-09-25 19:02:29 +02:00
results.go NOISSUE - Simplify MQTT benchmarking tool (#852) 2019-09-25 19:02:29 +02:00

README.md

MQTT Benchmarking Tool

A simple MQTT benchmarking tool for Mainflux platform.

It connects Mainflux things as subscribers over a number of channels and uses other Mainflux things to publish messages and create MQTT load.

Mainflux things used must be pre-provisioned first, and Mainflux provision tool can be used for this purpose.

Installation

cd tools/mqtt-bench
make

Usage

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

./mqtt-bench --help
Tool for extensive load and benchmarking of MQTT brokers used within Mainflux platform.
Complete documentation is available at https://docs.mainflux.io

Usage:
  mqtt-bench [flags]

Flags:
  -b, --broker string     address for mqtt broker, for secure use tcps and 8883 (default "tcp://localhost:1883")
      --ca string         CA file (default "ca.crt")
  -c, --config string     config file for mqtt-bench (default "config.toml")
  -n, --count int         Number of messages sent per publisher (default 100)
  -f, --format string     Output format: text|json (default "text")
  -h, --help              help for mqtt-bench
  -m, --mainflux string   config file for Mainflux connections (default "connections.toml")
      --mtls              Use mtls for connection
  -p, --pubs int          Number of publishers (default 10)
  -q, --qos int           QoS for published messages, values 0 1 2
      --quiet             Supress messages
  -r, --retain            Retain mqtt messages
  -z, --size int          Size of message payload bytes (default 100)
  -t, --skipTLSVer        Skip tls verification
  -t, --timeout           Timeout mqtt messages (default 10000)

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

Before use you need a mfconn.toml - a TOML file that describes Mainflux connection data (channels, thingIDs, thingKeys, certs). You can use provision tool (in tools/provision) to create this TOML config file.

Example use and output

Without mtls:

./mqtt-bench --broker tcp://localhost:1883 --count 100 --size 100 --qos 0 --format text --pubs 10 --mainflux mfconn.toml

With mtls ./mqtt-bench --broker tcps://localhost:8883 --count 100 --size 100 --qos 0 --format text --pubs 10 --mainflux mfconn.toml --mtls -ca ca.crt


You can use `config.toml` to create tests with this tool:

./mqtt-bench --config config.toml


Example of `config.toml`:

[mqtt] [mqtt.broker] url = "tcp://localhost:1883"

[mqtt.message] size = 100 format = "text" qos = 2 retain = true

[mqtt.tls] mtls = false skiptlsver = true ca = "ca.crt"

[test] pubs = 3 count = 100

[log] quiet = false

[mainflux] connections_file = "mfconn.toml"


Based on this, a test scenario is provided in `templates/reference.toml` file.