01 / performance engineering
Locust Performance Lab
Performance testing as code. A self-contained load testing framework that ships its own misbehaving system under test — one command spins up distributed load generation, live Grafana monitoring, automated memory-leak hunting, and an SLA gate that fails the CI build when latency budgets are breached.
✅ SLA gate — perf tests that can fail the build
Latency budgets live in slas.yml, per endpoint. A script parses Locust's CSV,
prints a verdict table into the GitHub job summary, and exits non-zero on any breach.
“A dashboard needs a human — an exit code scales.”
🧠 Memory-leak hunter
Samples container memory under constant load, discards warm-up, fits a least-squares trend — and fails only when both growth rate and total growth blow their budgets. Demonstrated against a simulated ~50 KB/request leak:
⚡ Load shapes as ~15 lines of code
Stress, spike and soak profiles are LoadTestShape classes selected by one env var —
one reviewed workload model serves every scenario.
class SpikeShape(LoadTestShape):
"""20-user baseline, sudden 10× spike."""
def tick(self):
t = self.get_run_time()
if t < 120: return (20, 5)
if t < 180: return (200, 50) # the spike
if t < 360: return (20, 50) # recovery
return None
📉 Regression detection, run over run
One run tells you where you are; comparing runs tells you where you're heading. Nightly CI diffs endpoint-by-endpoint and fails on p95 growth, throughput drops, or worsening error rate:
🐳 Distributed by default
make up WORKERS=8 — Locust master/worker split in plain Docker Compose,
FastHttpUser for ~10× RPS per generator. Same images scale across hosts or Kubernetes.
📊 Live observability
Pre-provisioned Grafana dashboard: RPS, p50/p95 overlaid with the user ramp, failures/s, and the leak-hunting memory panel — problems visible the moment they start, not in a PDF afterwards.
👥 Realistic workload model
75% browsers, 25% buyers running the full funnel as a SequentialTaskSet;
catch_response marks a 200-without-order_id as a failure —
wrong answers delivered quickly are still wrong.
smoke · baseline · stress · spike · soak · leak-test · compare — every scenario is one make target, every gate is an exit code