Skip to content

Commit eabff24

Browse files
hectcastrorbreslow
authored andcommitted
Add basic k6 load test for PA/50 district project
I manually filled out a 50 district PA project and exported it as a HAR file. From there, I used har-to-k6 converter to produce a k6 load test. Lastly, I created a few parameters to make the test more reusable: - JWT_AUTH_TOKEN: A DistrictBuilder JWT authentication token - DB_PROJECT_ID: A DistrictBuilder project UUID (PA; 50 districts) - DB_DOMAIN: The DistrictBuilder instance domain where the project above resides
1 parent 644f6fa commit eabff24

File tree

4 files changed

+525
-1
lines changed

4 files changed

+525
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Project page sharing & read-only mode [#449](https://github.com/PublicMapping/districtbuilder/pull/449)
13-
- Set keep-alive timeout higher than ALB idle timeout[#448](https://github.com/PublicMapping/districtbuilder/pull/448)
13+
- Set keep-alive timeout higher than ALB idle timeout [#448](https://github.com/PublicMapping/districtbuilder/pull/448)
14+
- Add basic k6 load test for PA/50 district project [#448](https://github.com/PublicMapping/districtbuilder/pull/448)
1415

1516
### Changed
1617

load-tests/README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Load Testing
2+
3+
This [k6](https://k6.io/) based load testing project is focused on automating
4+
user requests that are known to stress parts of the application. All of the
5+
components necessary to execute a load test are encapsulated in this directory.
6+
7+
## Variables
8+
9+
- `JWT_AUTH_TOKEN`: A DistrictBuilder JWT authentication token
10+
- `DB_PROJECT_ID`: A DistrictBuilder project UUID (PA; 50 districts)
11+
- `DB_DOMAIN`: The DistrictBuilder instance domain where the project above resides
12+
13+
## Running
14+
15+
Below is an example of how to invoke an instance of the load test with Docker
16+
Compose:
17+
18+
```console
19+
$ export DB_JWT_AUTH_TOKEN="..."
20+
$ export DB_PROJECT_ID="f1824edc-588c-43d9-a094-1b914470910d"
21+
$ export DB_DOMAIN="app.staging.districtbuilder.org"
22+
$ docker-compose run --rm k6
23+
24+
/\ |‾‾| /‾‾/ /‾‾/
25+
/\ / \ | |/ / / /
26+
/ \/ \ | ( / ‾‾\
27+
/ \ | |\ \ | (‾) |
28+
/ __________ \ |__| \__\ \_____/ .io
29+
30+
execution: local
31+
script: /scripts/pa-50-districts.js
32+
output: -
33+
34+
scenarios: (100.00%) 1 scenario, 20 max VUs, 3m30s max duration (incl. graceful stop):
35+
* default: 20 looping VUs for 3m0s (gracefulStop: 30s)
36+
37+
38+
running (3m26.9s), 00/20 VUs, 60 complete and 0 interrupted iterations
39+
default ✓ [======================================] 20 VUs 3m0s
40+
41+
█ Picking PA districts
42+
43+
data_received..............: 386 MB 1.9 MB/s
44+
data_sent..................: 1.9 MB 9.3 kB/s
45+
group_duration.............: avg=1m5s min=57.16s med=1m4s max=1m15s p(90)=1m14s p(95)=1m14s
46+
http_req_blocked...........: avg=1.38ms min=100ns med=200ns max=92.56ms p(90)=500ns p(95)=600ns
47+
http_req_connecting........: avg=211.51µs min=0s med=0s max=16ms p(90)=0s p(95)=0s
48+
http_req_duration..........: avg=2.98s min=32.23ms med=2.34s max=15.69s p(90)=5.78s p(95)=8.22s
49+
http_req_receiving.........: avg=519.78ms min=14.3µs med=268.25µs max=10.05s p(90)=1.69s p(95)=2.42s
50+
http_req_sending...........: avg=83.68µs min=21.9µs med=72.95µs max=985.8µs p(90)=130.32µs p(95)=142.11µs
51+
http_req_tls_handshaking...: avg=871.29µs min=0s med=0s max=60.4ms p(90)=0s p(95)=0s
52+
http_req_waiting...........: avg=2.46s min=31.95ms med=1.61s max=15.69s p(90)=5.26s p(95)=7.2s
53+
http_reqs..................: 1320 6.379084/s
54+
iteration_duration.........: avg=1m6s min=58.16s med=1m5s max=1m16s p(90)=1m15s p(95)=1m15s
55+
iterations.................: 60 0.289958/s
56+
vus........................: 4 min=4 max=20
57+
vus_max....................: 20 min=20 max=20
58+
```

load-tests/docker-compose.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "3"
2+
services:
3+
k6:
4+
image: loadimpact/k6
5+
environment:
6+
- DB_JWT_AUTH_TOKEN
7+
- DB_PROJECT_ID
8+
- DB_DOMAIN=${DB_DOMAIN:-app.staging.districtbuilder.org}
9+
volumes:
10+
- ./:/scripts/
11+
command: run /scripts/pa-50-districts.js

0 commit comments

Comments
 (0)