Skip to content

Commit 579e685

Browse files
committed
perf: add real e2e tracing and cold-path perf toolkit
1 parent 36ba1bb commit 579e685

File tree

9 files changed

+733
-45
lines changed

9 files changed

+733
-45
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Cold Path Real E2E Baseline (2026-02-20)
2+
3+
## Context
4+
- Objective: reduce `/music` cold-path p95 latency with real-traffic evidence.
5+
- Decision metric: `e2e_total` p95 from structured `PERF` logs.
6+
- Synthetic benchmark is recorded as reference only.
7+
8+
## Data Source
9+
- Log source: `data/manual-test/coldpath.log`
10+
- Parser: `scripts/perf_log_report.py`
11+
- Sample target: `>= 30` cold requests per topology
12+
13+
## Topology Baseline
14+
15+
| Topology | Requests | e2e p50 (ms) | e2e p95 (ms) | e2e max (ms) | Notes |
16+
|---|---:|---:|---:|---:|---|
17+
| official_api | TBD | TBD | TBD | TBD | |
18+
| selfhost_api_uri_upload / selfhost_api_multipart_upload | TBD | TBD | TBD | TBD | |
19+
20+
## Stage Share Snapshot (p95)
21+
22+
| Topology | Dominant Stage 1 | Dominant Stage 2 | Dominant Stage 3 |
23+
|---|---|---|---|
24+
| official_api | TBD | TBD | TBD |
25+
| selfhost_api_uri_upload / selfhost_api_multipart_upload | TBD | TBD | TBD |
26+
27+
## Synthetic Reference (Non-decision)
28+
- Command: `python3 scripts/perf_compare.py`
29+
- Reference artifact: `docs/perf/2026-02-11-parallel-optimization-baseline.md`
30+
31+
## Optimization Loop
32+
1. Collect baseline real logs.
33+
2. Apply minimal hot-path optimization.
34+
3. Re-sample with same workload shape.
35+
4. Compare `e2e_total` p95 and stage p95 shares.
36+
5. Iterate until soft target (~20%) or clear bottleneck plateau.
37+
38+
## Result Summary (Fill After Run)
39+
- official_api p95 delta: `TBD`
40+
- selfhost_api_uri_upload/selfhost_api_multipart_upload p95 delta: `TBD`
41+
- achieved soft target (~20%): `TBD`
42+
- next priority if not reached: `TBD`
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Cold Path Real E2E Performance Runbook
2+
3+
## Goal
4+
Measure real `/music` cold-path latency using production-like traffic and parse structured `PERF|...` logs.
5+
6+
## Scope
7+
- Primary path: first `/music` cold requests (cache miss)
8+
- Topologies:
9+
- `official_api`
10+
- `selfhost_api_uri_upload` (self-hosted API + URI upload mode)
11+
- `selfhost_api_multipart_upload` (self-hosted API + multipart upload mode)
12+
- Decision metric: `e2e_total` p95
13+
14+
## Prerequisites
15+
1. Build and run the bot with `loglevel=info` or `loglevel=debug`.
16+
2. Ensure requests are cold path samples (avoid repeated same `music_id` cache hits).
17+
3. Collect logs to file.
18+
19+
Example:
20+
21+
```bash
22+
cargo run --release -- --config config.ini 2>&1 | tee data/manual-test/coldpath.log
23+
```
24+
25+
## Sampling Plan
26+
1. Official API: capture at least 30 cold-path requests.
27+
2. Self-hosted API mode (local or remote deployment): capture at least 30 cold-path requests.
28+
3. Separate self-hosted data by upload mode (`selfhost_api_uri_upload` vs `selfhost_api_multipart_upload`).
29+
4. Keep request set comparable (song size/category mix).
30+
31+
## Parse and Report
32+
Generate overall report:
33+
34+
```bash
35+
python3 scripts/perf_log_report.py \
36+
--log-file data/manual-test/coldpath.log \
37+
--cache-path miss_cold \
38+
--markdown-output docs/perf/2026-02-20-coldpath-overall.md \
39+
--json-output docs/perf/2026-02-20-coldpath-overall.json
40+
```
41+
42+
Generate per-topology reports:
43+
44+
```bash
45+
python3 scripts/perf_log_report.py \
46+
--log-file data/manual-test/coldpath.log \
47+
--topology official_api \
48+
--cache-path miss_cold \
49+
--markdown-output docs/perf/2026-02-20-coldpath-official.md \
50+
--json-output docs/perf/2026-02-20-coldpath-official.json
51+
52+
python3 scripts/perf_log_report.py \
53+
--log-file data/manual-test/coldpath.log \
54+
--topology selfhost_api_uri_upload \
55+
--cache-path miss_cold \
56+
--markdown-output docs/perf/2026-02-20-coldpath-local-uri.md \
57+
--json-output docs/perf/2026-02-20-coldpath-local-uri.json
58+
```
59+
60+
If URI upload is disabled in a run, use topology filter `selfhost_api_multipart_upload`.
61+
62+
## Acceptance Rule
63+
- Soft target: cold-path `e2e_total` p95 improves by ~20%.
64+
- If target is not reached, still deliver:
65+
- stage-level p95 shares (`upload_send`, `tag_process`, `select_url`, `db_save`, etc.)
66+
- bottleneck evidence and next optimization priorities.
67+
68+
## Reference (Synthetic)
69+
Synthetic benchmark remains useful for regression sanity checks only:
70+
71+
```bash
72+
python3 scripts/perf_compare.py
73+
```
74+
75+
Do not use synthetic output as final optimization decision data.

0 commit comments

Comments
 (0)