K6 Load Test Configuratie - Atraxion Middleware
Overzicht
We hebben 9 K6 test scripts in tests/performance/, verdeeld in twee categorieen:
1. Inbound tests (POST - Odoo naar Middleware)
| Test | Endpoint | Default VUs | Default duur | P95 threshold |
|---|---|---|---|---|
load-test-products.js |
POST /api/v1/products |
10 | 2m | < 2000ms |
load-test-partners.js |
POST /api/v1/partners |
10 | 2m | < 2000ms |
load-test-stocks.js |
POST /api/v1/stocks |
10 | 2m | < 2000ms |
load-test-sale-orders.js |
POST /api/v1/sale-orders |
10 | 2m | < 2000ms |
Elke VU stuurt continu POST requests met random payloads uit JSONL bestanden. Geen sleep/pauze tussen requests.
2. Outbound tests (GET - Middleware naar Webshop)
| Test | Endpoint | Default VUs | Default duur | P95 threshold |
|---|---|---|---|---|
load-test-outbound-products.js |
GET /api/v1/updated-products |
10 | 1m | < 500ms |
load-test-outbound-partners.js |
GET /api/v1/updated-partners |
10 | 1m | < 500ms |
load-test-outbound-sale-orders.js |
GET /api/v1/updated-sale-orders |
10 | 1m | < 500ms |
load-test-outbound-stocks.js |
GET /api/v1/stocks/changed |
10 | 1m | < 500ms |
load-test-outbound-pricelists.js |
GET /api/v1/pricelists/updated |
10 | 1m | < 500ms |
GET endpoints pagineren met random offset en ?limit=50.
Test data
| Bestand | Aantal payloads |
|---|---|
test-products.jsonl |
20.000 |
test-partners.jsonl |
10.000 |
test-sale-orders.jsonl |
10.000 |
test-stocks.jsonl |
10.000 |
Hoe de testen draaien
Voorbeeld: inbound (POST) test
k6 run \
-e BASE_URL=https://middleware.atraxion.com \
-e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 \
-e CONCURRENCY=10 \
-e DURATION=2m \
tests/performance/load-test-products.js
Voorbeeld: outbound (GET) test
k6 run \
-e BASE_URL=https://middleware.atraxion.com \
-e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 \
-e CONCURRENCY=10 \
-e DURATION=1m \
-e LIMIT=50 \
tests/performance/load-test-outbound-products.js
Configureerbare parameters
| Variabele | Default (inbound) | Default (outbound) | Beschrijving |
|---|---|---|---|
BASE_URL |
http://localhost:8000 |
https://localhost:8000 |
Target URL |
API_TOKEN |
(leeg) | (leeg) | Bearer token voor authenticatie |
CONCURRENCY |
10 | 10 | Aantal gelijktijdige virtual users |
DURATION |
2m | 1m | Testduur |
LIMIT |
n/a | 50 | Items per pagina (alleen outbound) |
DEBUG |
(niet gezet) | (niet gezet) | Log errors naar console |
Executor type
Alle tests gebruiken constant-vus - een vast aantal VUs dat continu requests stuurt gedurende de hele duur. Er is geen ramp-up/ramp-down en geen sleep tussen requests, wat betekent dat elke VU zo snel mogelijk achter elkaar requests stuurt.
Thresholds
- Inbound (POST): 99% success rate, P95 latency < 2000ms
- Outbound (GET): 99% success rate, P95 latency < 500ms
Alle tests na elkaar draaien
# Inbound tests
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=2m tests/performance/load-test-products.js
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=2m tests/performance/load-test-partners.js
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=2m tests/performance/load-test-stocks.js
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=2m tests/performance/load-test-sale-orders.js
# Outbound tests
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=1m tests/performance/load-test-outbound-products.js
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=1m tests/performance/load-test-outbound-partners.js
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=1m tests/performance/load-test-outbound-sale-orders.js
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=1m tests/performance/load-test-outbound-stocks.js
k6 run -e BASE_URL=https://middleware.atraxion.com -e API_TOKEN=7d830f6bd74dd386e991e04b4d0326bebc9d951d273c126ebd7394fc0f4ec377 -e CONCURRENCY=10 -e DURATION=1m tests/performance/load-test-outbound-pricelists.js