To test the performance of the HPI-SchulCloud application, multiple useres will be simulated by the loadtest. It creates a provided number of users, which are different by their user-type (admin, techer, pupil), and swarms the system simultaneausly, simulating their behavior. Courses, BBB-rooms, tasks etc. will be created, edited and deleted to generate additional traffic, and is captured on the Locust web-interface for subsequent analysis. Actually the loadtest implementation provides two kinds of starting the tests:
- scalable load tests which are designed to run with a specified number of user from the locust web interface
- functional tests which do not scale but execute the same tests as the load tests, this startup typ could be used for smoke testing a fresh deployed instance or regular verfying the proper funtion of a running instance The functional tests provide the number of executed and failed tests as Prometheus metrics to allow alerting on failed tests.
- Python (>= 3.6.10)
- ChromeDriver (>= 90.0.4430.24, just necessary for BBB-Loadtest, Document-Loadtest)
- Docker (>= 19.03.5, optional)
- Download ChromeDriver
- The chromedriver.exe needs to be in the same path as the locustfile.py-File
- Configure the environment
- Shared Variables
- PYTHONPATH=./src:${PYTHONPATH}
- ADMIN_EMAIL=[email protected]
- ADMIN_PASSWORD=<admin_password>
- TEACHER_EMAIL=[email protected]
- TEACHER_PASSWORD=<teacher_password>
- PUPIL_EMAIL=[email protected]
- PUPIL_PASSWORD=<pupil_password>
- ANONYMOUS_EMAIL=[email protected]
- ANONYMOUS_PASSWORD=<anonymous_password>
- BBB_ROOM_COUNT : INT of Rooms of BBB
- BBB_USER_COUNT : INT of Users per Room
- WEIGHT_ADMIN : INT users weight
- WEIGHT_TEACHER : INT users weight
- WEIGHT_PUPIL : INT users weight
- WEIGHT_ANONYMOUS : INT users weight
- WEIGHT_ACTUAL_ANONYMOUS : INT users weight
- WAIT_TIME_SHORT : Time in Sec
- WAIT_TIME_LONG : Time in Sec
- Load Test specific Variables
- FUNCTIONAL_TEST : 0
- Functional Test specific Variables
- FUNCTIONAL_TEST : 1
- TARGET_URL : Specify the instance to be tested as FQDN, e.g. https://nidersachsen.cloud
- Optional:
- TIMEINTERVAL_SEC : Time in sec to sleep between repeated tests, default is 300
- PROMETHEUS_PORT port to expose Prometheus metrics, default is 9000
- Install required programs with
pip3 install -r requirements.txt
To run the load test, first open a command line and start locust with the following command:
`locust -f ./locustfile.py --host https://hackathon.hpi-schul-cloud.de --tags test`
Insert the right host after the '--host' tag*
- The '--tags test' tag is optional and will only start tasks which are marked with this tag*
Afterwards, start your webbrowser and open localhost:8089
or http://127.0.0.1:8089/
. The locust web-interface should load, and you can fill out the form and start swarming.
For further information about running locust check out their documentation.
docker run -it --rm --entrypoint /bin/sh -v "$(pwd)":/app -w /app locustio/locust:0.14.4
pip install -r requirements.txt
locust -f ./locustfile.py --no-web --clients 20 --run-time 30s --host https://hackathon.hpi-schul-cloud.de --logfile $(date '+%Y-%m-%d-%H:%M:%S')-hackathon.log --csv=$(date '+%Y-%m-%d-%H:%M:%S')-hackathon
Execute the following command at the top level of the repository
python3 src/loadtests/functionaltests/main.py