Page History
(Experiences from the University of Zurich, IT, ZORA Repository:)
To test the performance of our services (Eprints, DSpace, ...) we recommend the open source load testing tool Locust - https://locust.io
...
locust install: pip3.11 install locust
01 Simple scenarios ("Hello World" mode)
Configuration
Simply pass through the URL entered at the start in the input form ("Number of Users", "Spawn rate", "Host") and test it - e.g. test the homepage of your DS7 repo
vi locustfile.py
|
more on configs read https://docs.locust.io/en/stable/writing-a-locustfile.html#writing-a-locustfile
...
Attention: Standard http vs. https; Certs and Keys
[2024-01-31 14:40:56,153] INFO/locust.main: Starting web interface at https://0.0.0.0:8089 [2024-01-31 14:40:56,166] INFO/locust.main: Starting Locust 2.20.1 |
UI
call Browser https://SERVERNAME:8089/ and start loadtests. First easy with 1 user:
(Attention: use trailing slash at the end of 'HOST'!)
...
See charts, failures, statistics and many more...
...
02 Real
test scenarios (static & dynamic content)
Homepage
SubPage Communities
Search
Login Process incl. Token Autentication
...
Configuration (“complex” Mode)
vi locustfile.py
|
Notes
- 2 types of users (anonymous, registered user), login with token handling
- further, sequential storybook possible: login, workflow, upload, edit metadata, logout
...
Error rate increases as soon as system is overloaded
03 Really hard test scenarios: Recording workflow steps in FireFox to generate script for Locust
Creating a Locust configuration file from scratch is sometimes difficult, especially when complex workflows and work steps need to be analysed.
One solution is to record typical work steps in the browser and save them in HAR format (https://en.wikipedia.org/wiki/HAR_(file_format)). This, in turn, can be created with the tool har2locust (https://github.com/SvenskaSpel/har2locust) into locustfile.py configuration files and an analysis as described above is ready to go.
The procedure:
- read the notes on https://github.com/SvenskaSpel/har2locust
- [locust]$ pip3.11 install har2locust
Record FF session:
- Open DS7 page in browser
- Menu / Tools for developers | right mouse button + Examine
- Network analysis tab, click on trash basket symbol (delete) - from then on the recording of the activities runs
- Execute DS7 actions (Login, MyDSpace, ... Logout)
- In the end goto column "File", click right mouse button, "Save as Har-File" and save the recording
- sftp Har-File => SERVER
- [locust]$ har2locust x1.har > locustfile.py
- [locust]$ locust --tls-cert /etc/pki/tls/certs/SERVERNAME/cert.pem --tls-key /etc/pki/tls/certs/SERVERNAME/privkey.pem
Links
- https://locust.io/
- https://docs.locust.io/en/stable/
- https://docs.locust.io/en/stable/writing-a-locustfile.html#writing-a-locustfile
- https://medium.com/dana-engineering/load-testing-at-web-application-api-using-locust-2b297c5771ab
- https://www.blazemeter.com/blog/locust-python
...