Basic tool (based on Locust.io) to perform load test of Rasa based chatbot via REST API.
We use it to test our bots and create fact-based sizing calculators.
- You should have Rasa bot :)
- You should enable Rasa REST API endpoint (see Rasa docs on how to do it - final method depends on your deployment method)
- Bot's REST API endpoint should be acessable via network
- Python 3
- Locust.io
python -m venv venv
source venv/bin/activate
install -r requirements.txt
Correct REST API URL in rasa-rest-explode-brain.py
(it depends on your Rasa installation)
Common RasaX endpoint: /core/webhooks/rest/webhook
Common Rasa Open Source endpoint: webhooks/rest/webhook
Launch Locust:
locust -f rasa-rest-explode-brain.py
then open Locust Web UI http://127.0.0.1:8089, enter number of Users, Hatch rate and your Rasa host (e.g. http://localhost:5005) and press 'Start swarming'
I've used this dataset to generate Rasa configuration with some Python scripts (150 intents with 100 training phrases each = 15 000 phrases and 150 generated stories with length=6 steps)
With this stress test i've managed to get stable 300 concurrent users, ±45 rps, with response time around 370ms (95th percentile) - which is pretty impressive imho.
Testing environment: MacBook Pro 13 2017 with launched in parallel VSCode, MS Teams, Safari, Mail, etc.