Simulate load on MQTT broker.
When started the simulator ramps up client number during MQTT_LOAD_RAMP_UP_SECONDS
seconds (defaut is 10)
until it reaches MQTT_LOAD_MIN_CLIENTS
(default is 2) clients.
After that clients start and stop randomly to keep its number between MQTT_LOAD_MIN_CLIENTS
and MQTT_LOAD_MAX_CLIENTS
(default is 2) or stay constant if these 2 parameters are equal.
Once connected, each client does a random action
(publish message, subscribe to the topic, unsubscribe from the topic, do nothing)
each MQTT_LOAD_CLIENT_STEP_INTERVAL
milliseconds (2000 by default).
Probabilities are controlled by MQTT_LOAD_CLIENT_STEP_INTERVAL
,
MQTT_LOAD_CLIENT_STEP_INTERVAL
, MQTT_LOAD_CLIENT_STEP_INTERVAL
and MQTT_LOAD_CLIENT_IDLE_PROBABILITY
.
Publish message payload is a random text of the dictionary words. Its length is randomly picked between
MQTT_LOAD_MESSAGE_MIN_SIZE
(default is 10) and MQTT_LOAD_MESSAGE_MAX_SIZE
(default is 600) bytes.
Prometheus metrics are exposed on port MQTT_LOAD_MONITORING_PORT
(default is 1884).
For complete list of configuration parameters check src/main/resources/application.conf
.
Pre-requisites: - Docker
Copy toolbelt/runDocker.sh
, customize the parameters you want and run it.
Pre-requisites:
- GCP account
- Terraform (0.12) or newer installed locally
- Download
account.json
from GCP Account intotoolbelt/terraform_gcp
directory. You will have to create a service account on GCP first if you don't have one. Choose the right roles and enable google API. If something is missing terraform let you know at a later steps and allow to retry after adding necessary roles. Once you have a Service Account, you can getaccount.json
this way:- Open GCP Console in the web browser
- Go to "IAM & admin / Service Accounts" section
- Click "Actions / Create Key" for the specific service account, choose JSON key
- Download .json file, rename it to
account.json
- Copy to terraform-gcp and terraform-gcp-ccloud directories`
- Choose a
GCP project
or create a new one on your cloud console. Terraform will prompt you to specify your project name when applying. Write down the following information, you will need it in the next steps:- your GCP project name
- your GCP region
- your GCP zone
- Copy configuration file example:
cd toolbelt/terraform_gcp
cp config-examples/config.auto.tfvars.example ./config.auto.tfvars
- Customize config file
config.auto.tfvars
with the GCP project parameters, MQTT broker connection data and desired load settings - Run it with
toolbelt/terraform_gcp/apply.sh
. Upon successful start it will print the URL of the Grafana dashboard. Default credentials are "admin/admin" - When done - run
toolbelt/terraform_gcp/destroy.sh
to stop it
Pre-requisistes:
- Kubernetes cluster
kubectl
installed locally, configured with your k8s cluster credentials
- Copy config file example:
cd toolbelt/k8s
cp config.sh example config.sh
- Customize config file with MQTT broker location and desired load settings
- Run the load simulator with
toolbelt/k8s/apply.sh
- When done - run
toolbelt/k8s/undeploy.sh
to stop it.