Files
cfw-autumn/server/perf/load-test/memoryLeak.yml

72 lines
1.7 KiB
YAML

# Memory leak detection — 2 min sustained load (snapshots handled by runLeakTest.ts).
# Usage: cd server && bun loadtest:leak
#
# This file is called by runLeakTest.ts which handles:
# 1. Baseline heap snapshot
# 2. Running this Artillery config
# 3. Target heap snapshot (right after load)
# 4. 60s cooldown for GC
# 5. Final heap snapshot
# 6. memlab analysis
config:
target: "http://localhost:8080"
processor: "./processor.mjs"
http:
timeout: 120
phases:
- duration: 15
arrivalRate: 1
rampTo: 5
name: "Warm-up"
- duration: 120
arrivalRate: 10
name: "Sustained (leak detection)"
defaults:
headers:
Authorization: "Bearer {{ $processEnvironment.UNIT_TEST_AUTUMN_SECRET_KEY }}"
Content-Type: "application/json"
scenarios:
# ~90% of VUs: lightweight check/track/get loop
- name: "Core API loop"
weight: 9
beforeScenario: "setCustomerContext"
flow:
- post:
url: "/v1/check"
json:
customer_id: "{{ customerId }}"
feature_id: "{{ featureId }}"
- post:
url: "/v1/track"
json:
customer_id: "{{ customerId }}"
feature_id: "{{ featureId }}"
value: 1
- get:
url: "/v1/customers/{{ customerId }}"
# ~10% of VUs: attach (upgrade/downgrade through Stripe)
- name: "Attach flow"
weight: 1
beforeScenario: "setAttachContext"
flow:
- post:
url: "/v1/billing.attach"
json:
customer_id: "{{ customerId }}"
product_id: "{{ productId }}"
- post:
url: "/v1/check"
json:
customer_id: "{{ customerId }}"
feature_id: "{{ featureId }}"