Thingsboard performance tests
Project that is able to stress test Thingsboard server with a huge number of MQTT messages published simultaneously from different devices.
To run test against ThingsBoard first create plain text file to set up test configuration (in our example configuration file name is .env):
touch .env
Edit this .env file:
nano .env
and put next content into the text file (modify it according to your test goals):
REST_URL=http://IP_ADDRESS_OF_TB_INSTANCE:9090
# IP_ADDRESS_OF_TB_INSTANCE is your local IP address if you run ThingsBoard on your dev machine in docker
# Port should be modified as well if needed
REST_USERNAME=tenant@thingsboard.org
REST_PASSWORD=tenant
MQTT_HOST=IP_ADDRESS_OF_TB_INSTANCE
# IP_ADDRESS_OF_TB_INSTANCE is your local IP address if you run ThingsBoard on your dev machine in docker
MQTT_PORT=1883
DEVICE_API=MQTT
DEVICE_START_IDX=0
DEVICE_END_IDX=10
DEVICE_CREATE_ON_START=true
DEVICE_DELETE_ON_COMPLETE=true
PUBLISH_COUNT=10
PUBLISH_PAUSE=1000
Where:
REST_URL
- Rest URL of the TB instanceREST_USERNAME
- Login of the userREST_PASSWORD
- Password of the userMQTT_HOST
- URL of the ThingsBoard MQTT brokerMQTT_PORT
- Port of the ThingsBoard MQTT brokerDEVICE_API
- Use MQTT or HTTP Device API for send messagesDEVICE_START_IDX
- First index of the device that is going to be used in the test. Token of the device is going to be index of this device during testDEVICE_END_IDX
- Last index of the device that is going to be used in the testDEVICE_CREATE_ON_START
- Create devices before testDEVICE_DELETE_ON_COMPLETE
- Delete devices after test, there were created on start of the testPUBLISH_COUNT
- Number of the messages to be published for a single simulated devicePUBLISH_PAUSE
- Pause between messages for a single simulated device in millisecondsMQTT_SSL_ENABLED
- Enable/disable ssl for MQTTMQTT_SSL_KEY_STORE
- MQTT key store file locationMQTT_SSL_KEY_STORE_PASSWORD
- MQTT key store file password
Once params are configured to run test simple type from the folder where configuration file is located:
docker run -it --env-file .env --name tb-perf-test thingsboard/tb-performance-test