gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmaind2e6d26bMerge branch 'records-park55' into mainTrackermain/reports/T17-boot.md

9.7 KB

  1. # T17 — tracker boot time (branch t17-boot, NOT merged / pushed / deployed) — HANDOFF, unfinished proof
  2. State at the stop (quota 81 %): code done and committed, gates green on an earlier commit, **the final three-run old/new table at a quiet
  3. machine, the 30-query HTTP search comparison and the short-id dump on the final code are NOT done** (see "Next step").
  4. ## 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)
  5. | phase | seconds (loreana, load 10–70) | note |
  6. |---|---|---|
  7. | 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 |
  8. | 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 |
  9. | episodes pass (1.5 M rows) | 84 s @70 / ~30 s @10 | catalog dates |
  10. | 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 |
  11. | list caches, franchises, moved slugs, hl:web server build | 3.5 + 0.1 + 2 + 9 s @70 | 1–4 s quiet |
  12. | short-id backfill (2 373 rows that are "taken by" themselves) | 3 s after listening | no-op, ids unchanged |
  13. 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**:
  14. 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 every
  15. retained 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).
  16. 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.
  17. ## The fix (3 commits on t17-boot: 593a635, c87149e, + "sync window 1000 ms")
  18. 1. `lib/bootscan.hl` is a **resumable step function** (`bootStep(budgetMs)`, table cursors, same per-row functions/order/log lines).
  19. `project.hl` runs it for `TRACKER_WARM_SYNC_MS` (default 1000; gates set 600000 = complete start as before), makes the server, and
  20. continues from a 4 ms clock (`TRACKER_WARM_STEP_MS`=60 per tick) **after the server listens**. `lib/warm.hl` = progress (titles → catalog → all).
  21. 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);
  22. `/my/*`, `/settings`, login need none. Writers that need the complete indexes refuse until all is built (`warmBlocked`: search import/web search,
  23. `completeStep`, person fill, guest star, `castPersonId`), `/<shortId>` and `/person/tmdb/..` answer 503 + Retry-After. The lazy full-scan
  24. fallbacks (`ensureSlugIds/ensureIndex/ensureShortIds/ensureSlugIndex/personIdByTmdb`) do not run while the scan is under way. **Jobs start when the scan is done.**
  25. (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.)
  26. 3. Fewer live objects: search entries as parallel arrays (`entId/entText/entTie/entKind`, words rebuilt from `text` for the few candidates;
  27. `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>'`,
  28. /people order as two flat arrays (only keys > 0 are sorted; stable, so the same order). `HL_GC_PACING` set per pass with `setEnv`
  29. (`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.
  30. ## Numbers
  31. Old (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.
  32. 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;
  33. 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.
  34. Quiet machine (load 3–6), sync window 1000 ms, three variants of the pacing (single runs, `tools/measure.sh` in the scratch dir):
  35. | pacing | first 200 | catalog pages ready | all ready | VmHWM |
  36. |---|---|---|---|---|
  37. | 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 |
  38. | 8,4,2,1 | 4.1 s | 29.3 s | 52.8 s | 6599 MB |
  39. | 8,3,3,1 | 4.2 s | 25.7 s | 52.9 s | 8470 MB |
  40. 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).
  41. ## Proof state
  42. * 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.
  43. * `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.
  44. * 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**.
  45. * 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**.
  46. ## Next step (for whoever continues)
  47. 1. rerun the 7 gates on HEAD of t17-boot (ports 8750–8762); add `node tests/warmstart.mjs` to deploy.sh GATES.
  48. 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.
  49. 3. run `cmpsearch.py` (42 queries) old vs new once both are warm, and dump short ids from both storage copies; diff.
  50. 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".
  51. 5. The first request after the deploy shows the note for ~1 min on lists/search/people; sessions/`/my/*` work at once.
  52. ## T18 — finish (branch t17-boot, NOT merged / pushed / deployed)
  53. Machine load during all T18 runs was 40–70 (other workers), so absolute seconds are far above T17's quiet-machine numbers; the old/new ratio is what counts.
  54. 1. **Gates on HEAD** (ports 8740–8752, `HL_PORT_BASE=8743`): browser 382/0 (first run 381/1: "repair: done" under load 10 — a resume-timing check; rerun 382/0), kinds 32/0, franchises 53/0, pager 229/0, franchiseseed 26/0, theme 0 problems, person-lookup passed, **warmstart 12/0** — equal to old main (382/32/53/229/26/4). `tests/warmstart.mjs` is now in `deploy.sh` GATES (it uses `TRACKER_GATE_PORT`, so `deploy-init.sh` needs no change).
  55. 2. **boot-gate.sh** (worldapi-conductor): after the first 200 + settle, if the container log contains `boot scan: listening first` it waits for `boot scan: done` (`BOOT_GATE_SCAN_WAIT`, default 300 s) while still checking RestartCount / state / `errno 24|runtime error` every 3 s; `scan=crashed` or `scan=running` (timeout) fails the gate. Apps without that line behave as before. Tested: dry-run on notes (PASS, 34 s, unchanged path); the new wait branch simulated with a fake `docker` for done / crash / hang → scan=done, crashed, running. Not run for tracker on Byrodin (needs the t17 code + a hot copy of the live storage).
  56. 3. **3×3 table** (copy of backup 20261022-1322, HL_GC_TABLE_LOAD=62, TRACKER_SYNC=0), run order old/new interleaved:
  57. | run | load at start | first 200 | boot scan: done | VmHWM |
  58. |---|---|---|---|---|
  59. | old1 | 71 | 529 s | 517 s | 5807 MB |
  60. | new1 | 57 | 109 s | 452 s | 4523 MB |
  61. | old2 | 59 | 507 s | 494 s | 5935 MB |
  62. | new2 | 60 | 88 s | 387 s | 4212 MB |
  63. | old3 | 48 | 488 s | 479 s | 6123 MB |
  64. | new3 | 43 | 62 s | 258 s | 4713 MB |
  65. New is 4.8–8× faster to the first 200 and ≈1.9× faster to "scan done", VmHWM 22–26 % lower, CPU 258–352 s vs 426–436 s. **The < 30 s target was NOT reproduced here: at load 43–60 the first 200 is 62–109 s** (the sync window is 1 s, the rest is Hybriel start + table opens, which stretch with the load; T17 measured 4 s warm / 25 s cold at load 3–6). Must be re-measured on a quiet machine or judged on Byrodin.
  66. 4. **30-query HTTP search** (`/search/<q>`, old vs new, both fully scanned): 30/30 identical. Raw HTML differs only in the port, the asset hash and an empty hydration marker `<!--[--><!--]-->` inside `<search-page>` (the new warming-note conditional, rendering nothing); comparison strips HTML comments. Accepted.
  67. 5. **Short-id dump** (all 115 k shows + 680 k people = 795 382 rows `id shortId`): old-after-scan, new-after-scan and the untouched backup are byte-identical; no new ids assigned (`short ids: ... gets a new one` lines are the 2 373 self-taken no-ops, same in both).
  68. Logs: scratch T18/keep/. Copies and servers removed.

Branches

Latest commits

  • d2e6d26bMerge branch 'records-park55' into mainTracker
  • f567f025|||PR records: park #55, no Claude workers ruleTracker
  • c21aff6bMerge branch 'records-hm55c' into mainTracker
  • 9ba258d3|||PR records: HM55b resultTracker
  • 64f2d300Merge branch 'records-hm55b2' into mainTracker
  • ae3b80dc|||PR records: HM55b briefTracker
  • 7ef3cb3bMerge branch 'records-st55' into mainTracker
  • fec2e080|||PR records: STATUS HM55Tracker
  • 8e174918Merge branch 'records-hm55b' into mainTracker
  • b1ecee57|||PR records: HM55 stateTracker
  • 28eab08cMerge branch 'records-hm55' into mainTracker
  • d3edaa05|||PR records: HM55 start, PROCEDURES.mdTracker
  • 3059f86cMerge branch 'records-design-rule' into mainTracker
  • 421a4809|||PR records: his-design rule (Apollo 2026-11-13)Tracker
  • d1390692Merge branch 'records-dp75b' into mainTracker
  • a4d1a7d2|||PR records: later steps checked, branch auditTracker
  • e070e16fMerge branch 'records-dp75' into mainTracker
  • 642b4fa8|||PR records: DP75 day62 live, AP62 briefTracker
  • bfc4ea4dMerge branch 'ap62' into mainTracker
  • 2c95ac46|||PR AP62: re-vendor Hybriel set day62 (source 70341ad2, bin a54f5f08)Tracker