Performance Engineering
Beyond load test
- Architecture review.
- Code profiling.
- DB optimization.
- Caching strategy.
- Capacity planning.
- Right-sizing infra.
Process
- Define SLO/SLA — what is acceptable?
- Baseline — measure current.
- Identify bottleneck — profile, monitor.
- Optimize — fix bottleneck.
- Validate — re-measure.
- Repeat.
SLI/SLO/SLA
- SLI — indicator (metric).
- SLO — objective (target).
- SLA — agreement (with consequence).
Example:
- SLI: p95 API latency.
- SLO: p95 < 500ms 99% of time.
- SLA: refund customer if SLO miss > 1h.
Common bottlenecks
- DB — slow query, missing index, N+1.
- Network — chatty API, large payload.
- CPU — inefficient algorithm, GC pressure.
- Memory — leak, large object.
- Disk — slow IO.
- External — third-party API slow.
Tools
- APM: Datadog, NewRelic, Dynatrace.
- Profiler: pprof, Async Profiler (Java), pyflame.
- DB: pg_stat_statements, MySQL slow query log.
- Tracing: Jaeger, Honeycomb, Zipkin.
Capacity planning
- Forecast traffic 6-12 month.
- Stress test 2-3× current.
- Identify scaling cliff.
- Auto-scaling rules.
VN context
Tết peak: e-com 10× normal, banking 5×, food delivery 7×.
Production capacity buffer always > peak forecast 30%.
Performance budget
Set per page / per request:
- Mobile homepage < 200KB.
- API p95 < 500ms.
- DB query < 100ms.
- Block release if regression > 10%.