The schulcloud-synapse-synchronization project is used to generate random test users on a test system.
- Clone the synchronization project:
git clone [email protected]:hpi-schul-cloud/schulcloud-synapse-synchronization.git
- Create a
.env
file in the cloned project to configure the system to test:
MATRIX_URI = https://matrix.domain.tld
MATRIX_SERVERNAME = matrix.domain.tld
MATRIX_SYNC_USER_NAME = sync
MATRIX_SECRET = XXX
- Install the dependencies
npm install
Run the integration tests to create test users and save them in a file (users.json
):
npm run test:integration
The users.json
file contains a list of users in the format:
[
{
"userId":"@xxx:matrix.xxx.tld",
"accessToken":"xxx"
}
]
- Clone this project:
git clone [email protected]:hpi-schul-cloud/synapse-load-test.git
- Setup python dependencies:
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
-
Copy the generated
users.json
file to the data folder of this project. -
Create a
config.json
file in the data folder, which contains the secret for logins:
{
"shared_secret": "SECRET"
}
Validate the setup by simulating only one user:
locust -u 1 -r 1 -H https://matrix.domain.tld
Open the Locust UI in your browser http://127.0.0.1:8089/ and start it.
If everything works more users could be simulated. The following command starts more and more users to see at what number problems arise:
locust -u 3000 -r 100 --step-load --step-users 200 --step-time 30s -H https://matrix.domain.tld
To avoid limitations of a desktop computer or its internet connection it is advisable to execute locust on a remote machine. Create an instance with open SSH (22) and locust web ui (8089) ports.
Copy the test files
scp locustfile.py user@host:locustfile.py
scp requirements.txt user@host:requirements.txt
scp -r data user@host:data
Setup for ubuntu 18.04 with 4 cores:
# dependencies
sudo apt update
sudo apt install python-dev python-subprocess32 python3-pip -y
pip3 install -r requirements.txt
# increase open files limitations
ulimit -n 65535
# start worker in the background
locust --worker &
locust --worker &
locust --worker &
# start the master and configure locust via the ui on port host:8089
locust --master