tracker
All repositories: gitoria
7.0 KB
# T17 — tracker boot time (branch t17-boot, NOT merged / pushed / deployed) — HANDOFF, unfinished proofState at the stop (quota 81 %): code done and committed, gates green on an earlier commit, **the final three-run old/new table at a quietmachine, the 30-query HTTP search comparison and the short-id dump on the final code are NOT done** (see "Next step").## Where the 120–145 s go (old code, be4890a, copy of backup 20261022-1322 = 115 k titles, 1.54 M episodes, 680 k people; HL_GC_TABLE_LOAD=62, TRACKER_SYNC=0, no token)| phase | seconds (loreana, load 10–70) | note ||---|---|---|| Hybriel start (cached compile, statics, table opens + index files) | 4 s quiet … 25 s loaded; cold compile after a code change +20–40 s | not tracker code; same before/after || titles pass (115 k fat rows: cast+crew) | 96 s @load 70 / ~50 s @10 | noteIndexShow, slug map, search entries, short-id owners, cast photos || episodes pass (1.5 M rows) | 84 s @70 / ~30 s @10 | catalog dates || people pass (680 k rows: search entries, owners, slug map, TMDB map, /people order) | 165 s @70 / ~70 s @10 | RSS grows 1.5 → 6 GB || list caches, franchises, moved slugs, hl:web server build | 3.5 + 0.1 + 2 + 9 s @70 | 1–4 s quiet || short-id backfill (2 373 rows that are "taken by" themselves) | 3 s after listening | no-op, ids unchanged |The decode alone (3 tables, iterate and nothing else) is only 28 CPU s (floor.hl). The rest of the ~300 CPU s boot scan is **GC**:the passes allocate fat rows against a small live heap (350 collections for the titles alone, `HL_GC_STATS` pause total 190 of 346 s), and everyretained entry is several live objects (search entry ≈ 11 objects/person, 7.9 M marked at the end; short-id owner 5.8; /people entry 2.9).Bench (tools/titlebench.hl, persons only, +CPU over the 6 s floor): search 37 s, owners 28, slug map 17, TMDB map 16, view 21.## The fix (3 commits on t17-boot: 593a635, c87149e, + "sync window 1000 ms")1. `lib/bootscan.hl` is a **resumable step function** (`bootStep(budgetMs)`, table cursors, same per-row functions/order/log lines).`project.hl` runs it for `TRACKER_WARM_SYNC_MS` (default 1000; gates set 600000 = complete start as before), makes the server, andcontinues from a 4 ms clock (`TRACKER_WARM_STEP_MS`=60 per tick) **after the server listens**. `lib/warm.hl` = progress (titles → catalog → all).2. Pages that need a stage not yet built show a note (`warming` in home/movies/series/shows/genre(s)/show/people/person/search/franchise editors);`/my/*`, `/settings`, login need none. Writers that need the complete indexes refuse until all is built (`warmBlocked`: search import/web search,`completeStep`, person fill, guest star, `castPersonId`), `/<shortId>` and `/person/tmdb/..` answer 503 + Retry-After. The lazy full-scanfallbacks (`ensureSlugIds/ensureIndex/ensureShortIds/ensureSlugIndex/personIdByTmdb`) do not run while the scan is under way. **Jobs start when the scan is done.**(A first try with per-page gate *parents* broke client-side navigation — different parent chains force a full page load, 10 browser-gate fails — dropped.)3. Fewer live objects: search entries as parallel arrays (`entId/entText/entTie/entKind`, words rebuilt from `text` for the few candidates;`text` keeps the year word — the old comment said otherwise, the old behaviour is kept), short-id owners as one string `'p<id>'/'s<id>'`,/people order as two flat arrays (only keys > 0 are sorted; stable, so the same order). `HL_GC_PACING` set per pass with `setEnv`(`TRACKER_GC_PACE` = 8,3,1,1 titles/episodes/people/after; never touched when the operator set `HL_GC_PACING`): the first run (8,4,2,1 only) cut the scan 346 → 122 s but VmHWM 8.8 GB; compaction + 8,3,1,1 = lower than old.## NumbersOld (be4890a), 3 runs, copy of the backup, load 10–12: **first 200 = 150.3 / 174.4 / 162.0 s**, VmHWM **6347 / 5935 / 5758 MB**, CPU 154 / 177 / 165 s.New (commit c87149e, sync window 3000 ms), 3 runs, load 9–12: **first 200 = 31.3 / 29.3 / 31.3 s**, VmHWM **4609 / 4409 / 4686 MB**, CPU 118–122 s;scan done ≈ 70 s after it started (log timestamps are buffered; the in-log "boot scan: done in 70974 ms"). First start after a code change (cold compile): 41.4 s.Quiet machine (load 3–6), sync window 1000 ms, three variants of the pacing (single runs, `tools/measure.sh` in the scratch dir):| pacing | first 200 | catalog pages ready | all ready | VmHWM ||---|---|---|---|---|| 8,3,1,1 (default; this run also had the cold compile) | 24.7 s (cold) | 47.9 s | 93 s @load 6 | 5785 MB || 8,4,2,1 | 4.1 s | 29.3 s | 52.8 s | 6599 MB || 8,3,3,1 | 4.2 s | 25.7 s | 52.9 s | 8470 MB |So with a warm compile cache the first 200 is ~4 s; **the 30 s target is met** (the 29–31 s above was a loaded machine with the 3 s window, now 1 s); the lists are there after ~25–50 s, everything after ~55–95 s (old: 150 s for everything). The remaining cost is the scan itself (2.3 M rows, ~60–95 CPU s); below that needs a persisted slim index or an mpackdb `iterate from offset` (Hybriel/mpackdb gap, no repro written).## Proof state* deploy gates (my ports 8750–8762), new code at 593a635 + later edits: browser 382/0, kinds 32/0, franchises 53/0, pager 229/0, franchiseseed 26/0, theme ok, person-lookup 4/0. **Old be4890a: identical counts** (382/32/53/229/26/4, 0 failed; logs in scratch keep/). The last commit (gates pass `TRACKER_WARM_SYNC_MS=600000`, project.hl sync default 1000) was **not** re-run through the full gates — do that first.* `tests/warmstart.mjs` (new gate, HTTP, port 8748): new code 12 passed / 0 failed; **old code 7 passed / 5 failed** (no note, no 503). Not yet in deploy.sh GATES.* search: first 42-query HTTP comparison old vs new found 6 diffs → cause: old `text` includes the year word (fixed in c87149e-era code); then dbSearch ids for 6 queries via the library path **IDENTICAL** (tools/qdump). The 30-query HTTP re-run on the final code is **open**.* short ids: nothing assigned in any run (793 009 with / 2 373 "taken by" themselves, `short ids done: assigned=0` old and new); the dump compare (tools/dumpsid.hl) on the two storages is **open**.## Next step (for whoever continues)1. rerun the 7 gates on HEAD of t17-boot (ports 8750–8762); add `node tests/warmstart.mjs` to deploy.sh GATES.2. 3 × old, 3 × new at a quiet machine with `tools/measure.sh` (scratch/T17/tools: run.sh, measure.sh, cmpsearch.py, dumpsid.hl) — pacing default 8,3,1,1 only has one quiet-load run; consider 6,3,1,1 if VmHWM matters more than seconds.3. run `cmpsearch.py` (42 queries) old vs new once both are warm, and dump short ids from both storage copies; diff.4. **boot-gate.sh** (Byrodin) settles only 10 s after the first 200 — with this change the scan runs *after* the 200 (~1–2 min at the live copy): extend BOOT_GATE_SETTLE or wait for the log line `boot scan: done` before judging errno 24 / runtime errors; deploy.sh's `after 30 s: 200` now means "listening", not "warm".5. The first request after the deploy shows the note for ~1 min on lists/search/people; sessions/`/my/*` work at once.
Branches
Latest commits
- 2a8682a1deploy.sh GATES: tests/warmstart.mjsmre
- 3761338breports/T17-boot.md: handoff (phase table, fix, numbers so far, open proof)mre
- 52e09eb2boot: sync window 1000 ms (the gates ask for a complete start), README boot-time sectionmre
- c87149e8tests/warmstart.mjs: the progressive start proven over HTTP (note in the window, 503 short id, after: everything); bootBeginmre
- 593a6350boot: resumable start-up scan, the server listens first (T17)mre
- be4890a0reports: H2 hydration audit (no test change needed)mre
- 1f9c8bf4re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- c1df88eddocker-compose: HL_GC_TABLE_LOAD=62 (tracker mission 048, T16 real-data numbers)mre
- d0a82867mission 048: report, LOG (HL_GC_TABLE_LOAD=62 measured)mre
- 2d4be66fre-vendor Hybriel 5df4eb7e (GC: HL_GC_TABLE_LOAD knob, mission 406)mre
- 99e7c8b9tests: realdata-m035-radii, repro-t38, realdata-060-backfill ports from env (REAL_PORT, REAL_CHROME, REPRO_CHROME), defaults unchangedmre
- 4625aa22re-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- a6dfd6ecdeploy: person-lookup gate (tracker#46)mre
- 33ad4bd5Merge commit 'f57f64f'mre
- 7d38cec4docker-compose: nofile 65536 (default soft 1024 refused boot: errno 24 in fs.listDir, Hybriel 528bc89f)mre
- f57f64f0mission 046: report, LOGmre
- 5965963adeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- efe1b485mission 046: re-vendor Hybriel master 60b2817b (integration 8, #203): plugins mpackdb + web (bin/ git-ignored: hybriel, libhlrt.a, hlc.o, hlrt/ from native/zig-out)mre
- 53099ffbmission 046: person page reads a slim per-title credit row cache (no whole-record fetch per credit); gate tests/person-lookup.mjsmre
- 9b3828aemission 046a: report, LOGmre