Stress/Performance Testing
Creating a large data set
The first step of performance testing is getting a large enough data set on an environment similar to the production one. For OpenIMIS, we are doing:
Generating data: the backend has a few commands like “generateinsurees” and “generateclaims” that will generate large amounts of random data with the help of the Faker library. This allows the use of localized data (names, phone numbers…)
Retrieve an existing data set, preferably anonymized: this approach was used to investigate the performance with the database of Nepal
Generate real-life traffic through the regular API: this is achieved by using Locust.io
Locust load testing
Locust.io is a open source load testing tool using Python. We created some helper methods for authentication and some service calls. From there, it is rather easy to create test scenarios.
Repository home: GitHub - openimis/openimis-loadtest: Mostly Locust.io load testing
The beginning of the script provides a few configuration parameters for the ready-made scenarios:
Then come a few functions that encapsulate a single action and annotated with @task
. These will be shown in the report with their performance metrics.
The on_start()
method performs the necessary authentication and supports both hybrid mode and full modular with JWT. (This allows the testing of older versions)
Did you encounter a problem or do you have a suggestion?
Please contact our Service Desk
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. https://creativecommons.org/licenses/by-sa/4.0/