← Back to Development Workflow
7.8 Performance Sizing & Risk Monitoring
This guide defines a repeatable benchmark workflow for:
- Generating installer-facing environment sizing suggestions.
- Detecting performance risks (slow routes, query-heavy pages, concurrency pressure).
- Driving targeted optimization work.
Overview
KMP ships with a performance sizing benchmark script at:
/workspaces/KMP/load_test.sh(wrapper)/workspaces/KMP/app/scripts/perf/sizing-benchmark.js(implementation)
The benchmark uses authenticated Playwright flows over production-like seed data and can optionally profile route-level SQL workload via MariaDB slow log tables.
Running the Benchmark
cd /workspaces/KMP
./load_test.sh
Artifacts are written to:
test-results/perf/sizing-report-<timestamp>.json
Key Environment Variables
| Variable | Default | Purpose |
|---|---|---|
KMP_BASE_URL |
http://127.0.0.1:8080 |
Base URL for benchmark traffic |
KMP_LOGIN_EMAIL |
admin@amp.ansteorra.org |
Login identity for authenticated routes |
KMP_LOGIN_PASSWORD |
TestPassword |
Login password |
KMP_ROUTE_RUNS |
5 |
Number of sequential profiling runs per route |
KMP_CONCURRENCY_LEVELS |
1,5,10,20 |
Virtual-user concurrency levels to test |
KMP_SLOW_REQUEST_MS |
1500 |
Slow-route threshold used for risk flags and sizing logic |
KMP_CPU_TARGET_UTIL_PCT |
70 |
CPU target utilization used to convert observed host load into capacity guidance |
KMP_MEMORY_TARGET_UTIL_PCT |
80 |
Memory target utilization used to convert observed host load into capacity guidance |
KMP_TELEMETRY_SAMPLE_MS |
500 |
Host telemetry sample interval (CPU%, memory%, load average) during concurrency tests |
KMP_ENABLE_DB_PROFILE |
1 |
Enables per-route SQL query-count/rows profiling |
KMP_DB_HOST |
127.0.0.1 |
DB host for SQL profiling |
KMP_DB_USER |
KMPSQLDEV |
DB user for SQL profiling |
KMP_DB_PASS |
P@ssw0rd |
DB password for SQL profiling |
KMP_DB_NAME |
KMP_DEV |
DB name for SQL profiling |
KMP_PERF_OUTPUT_DIR |
test-results/perf |
Report output directory |
Example:
KMP_CONCURRENCY_LEVELS=1,5,10,20,30 \
KMP_SLOW_REQUEST_MS=1800 \
./load_test.sh
Runtime Instrumentation for Ongoing Monitoring
KMP supports optional request timing logs to identify route regressions in staging/production-like environments.
Enable request timing instrumentation
Add to app/config/.env (or deployment environment):
PERF_REQUEST_LOG_ENABLED=true
PERF_SLOW_REQUEST_MS=750
PERF_LOG_ALL_REQUESTS=false
Optional external sink:
LOG_PERFORMANCE_URL=syslog://your-log-host:514
When enabled, slow requests are emitted to logs/performance.log with scope app.performance.
How to Use Results for Installer Sizing
The generated report includes:
- Route-level latency summary (avg/p50/p95)
- Concurrency throughput and error rates
- Optional DB profile per route (query count, rows examined, max query time)
- Auto-generated sizing recommendation tier
- Benchmark host telemetry and derived capacity model
How recommendation values are derived
recommendation.app and recommendation.database are now derived from measured benchmark-host behavior, not static defaults:
- Find the highest tested concurrency with:
- 0% request errors
- p95 route latency <=
KMP_SLOW_REQUEST_MS
- Read host telemetry at that concurrency (CPU p95 and memory p95).
- Convert observed utilization to capacity using target utilization guards:
- CPU target:
KMP_CPU_TARGET_UTIL_PCT(default 70%) - Memory target:
KMP_MEMORY_TARGET_UTIL_PCT(default 80%)
- CPU target:
- Split combined derived capacity into app/db guidance using a documented split model in the report.
This keeps recommendations tied to the actual benchmark machine and observed host pressure.
Use the recommendation as a starting point, then tune for:
- expected concurrent admin users
- plugin mix and workflow complexity
- database latency and I/O characteristics
- mail/queue/background workload
Performance Risk Triage Workflow
- Run
./load_test.shon current branch and capture report. - Prioritize risks in this order:
- Concurrency errors / high error rate
- Routes with p95 above threshold
- DB-heavy routes with high query counts or rows examined
- For each risky route:
- Inspect associated grid/contain queries.
- Validate index coverage and count query strategy.
- Re-run benchmark after changes.
- Track trend over time by keeping benchmark artifacts from each release branch.
Suggested Cadence
- Before release: run full benchmark and compare to previous release.
- After major feature merges: run targeted benchmark on impacted routes.
- After schema/index changes: run DB profile mode to confirm reduced query pressure.