gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmaind2e6d26bMerge branch 'records-park55' into mainTrackermain/reports/ST1-stalls.md

8.5 KB

  1. # ST1-stalls: read-only diagnosis of the remaining 2-14 s stalls (2026-11-03, RV28d live)
  2. Nothing was changed on live. Own measurements 12:30-12:49 CET: outside probe 1/s for 1000 s (640 requests), /proc sampler of the hybriel process (pid 2043568, 0.5 s, per-thread utime/stime/state/RSS), docker logs of the app and of nginx (`web`), session file counts. Data and scripts are in this directory (data/, scripts/, bench/).
  3. ## 1. What the stalls are
  4. - Probe: median 0.108 s, p90 0.99 s, p99 8.4 s, max 11.3 s; 38 of 640 requests took 2 s or more (one every ~26 s), 63 took 1 s or more; no non-200.
  5. - The process is never idle. Main thread (the one event-loop thread; the other 7 threads use almost no CPU) is on CPU 0.69 cores on average, 0.45 user + 0.19 system during stalls, state R in 66 % of samples and S in 32 %. Only 4 of 38 stalls were a solid 100 % single-thread run, and only 4 of ~417 half-second intervals inside stalls had zero CPU. So a stall is "the loop is busy with one long unit of work (CPU mixed with waiting)", not a GC-style solid freeze and not an idle wait.
  6. - Correlation with the app log: every one of the 38 stalls overlaps (by time interval) a background job step or a person fill that ran 1.5 s or longer. For comparison only 25 % of fast (<0.3 s) requests overlap such a job.
  7. - "details repair: slow step" (lib/jobs.hl repairTick, one title per step, 1.5-10.9 s each): overlaps 23 of 38 stalls (60 %), but only 4 of 476 fast requests (0.8 %). 35 slow steps in 17 min, 94 in the last 90 min, 173 s of blocked time in my 17 min. Several stalls match a step's length exactly (e.g. 12:34:59 stall 10.0 s vs step 10.9 s; 12:33:01 6.7 s vs 7.4 s; 12:40:17 7.5 s vs 8.1 s).
  8. - Person fills (lib/people.hl): 153 fills in 17 min (9 per min), 79 of them took 2 s or more wall time (median 2175 ms) although the TMDB time inside is only median 255 ms and steps median 2. The rest is waiting for the loop plus own work. Fills overlap 31 of 38 stalls.
  9. - The details repair queue is 65,339 incomplete titles (the brief's older figure was 5,697); it does ~800 titles per 27 min, so the job will keep stalling the site for about 30 more hours. Crawler-triggered person fills add new minimal titles to that queue (each fill adds titles from a filmography).
  10. - Not proven: why a step with 1-3 TMDB requests takes up to 10.9 s and keeps the main thread at about 50-65 % CPU instead of waiting. Candidates: TMDB/TVmaze response time plus the app's persist/upsert work against a 25 GB heap. Telling them apart needs a profiler, which is forbidden on live. A local run with a fake TMDB would show it.
  11. ## 2. Traffic and crawlers
  12. nginx log (shared by all sites, no host and no response time in the format; I counted only tracker routes /person, /photos, /posters, /movies, /series, /shows, without my curl): 1587 requests in 17 min (~93/min).
  13. - Declared bots 662 (42 %): meta-externalagent 350, other "bot" UAs (bingbot etc.) 312.
  14. - 672 (42 %) are one generic UA "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ... Chrome/145.0.0.0" with no referrer from ~800 different forwarded IPs: disguised scraper traffic. 253 are one Android WebView UA hitting only /photos.
  15. - Person pages: 760 requests, 0 with a referrer, 269 bingbot-type + 93 meta + the rest generic Chrome/145: effectively all person page traffic is crawling. Route mix: /person 665, /photos 253, /posters 250, /movies 242, /person/tmdb/<id> 95 (all 302), /series 65, /shows 17.
  16. - Each opened person page triggers or continues a person fill (9 per min) and "guest opened" creations. 153 fills in the same period against ~665 person page hits.
  17. ## 3. GC
  18. - Hybriel has HL_GC_STATS=1 (one line per collection, runtime/gc.hl, SPEC.md "Collection pacing"), plus HL_GC_PACING (1-16, default 1) and HL_GC_TABLE_LOAD. Live only has HL_GC_TABLE_LOAD=62 (docker env); STATS is off, so there is no GC log. I did not enable it.
  19. - Heap is 25.4-26.0 GiB RSS (container 25.43 GiB of 61.9), steady, with a single thread. Collection pacing 1 means a full mark of the live heap each time the allocation doubles, so any collection over a 25 GB heap is long. The samples show only 4 clean 100 % solid stalls, so GC is NOT the main cause but may be part of the 100 % runs (84 runs of at least 1.5 s at 90 %+ CPU, longest 11.3 s; I cannot tell them from compute). Proper answer: run a local copy with HL_GC_STATS=1 on a restored data copy.
  20. - Likely heap contributor: the sessions queue (section 4).
  21. ## 4. Sessions
  22. Code (plugins/web/sessions.hl):
  23. - open() runs at framework init: startPass() does `for (e of listDir(dir)) queue.push(e)` synchronously, then one slice. After that a new listing starts only when no pass runs and 3600 s passed since the last one (sweepEvery*12000 ms). So the whole listing is one blocking call at every boot, and then hourly after a pass has finished.
  24. - storeSlice() (40 ms budget, checks the clock every 64 files) is only called from maybeSweep(), and maybeSweep() is called from adopt() and from WebFramework.hl line 3613 inside the face call/socket-frame handler. Plain GET page loads, the thing the crawlers do, never run a slice. The 2.68 M queue entries live in the heap for the whole pass, hours.
  25. Local measurement (bin/hybriel from the repo, a replica of startPass/storeSlice, synthetic store, 64-hex file names, loaded machine so timings vary):
  26. - Listing 500,000 files: 2.4-2.6 s (400,000: 2.4-6.5 s), blocking. Linear extrapolation for 2.55 M: 12-33 s of one blocked loop at each restart. Peak memory of the listing queue ~1.27 GB for 400k entries, so about 3 KB per entry, ~8 GB for 2.55 M entries as a transient/live heap addition.
  27. - One slice drains about 2,000-2,100 files (40 ms) locally, i.e. ~52,000 files/s while a slice runs. The worst slice 41 ms (one 443-843 ms outlier was a GC/alloc effect).
  28. Live drain, `ls -f | wc -l` in .sessions (2.4 s, read only): 12:30:11 2,672,987 files, 12:47:28 2,554,888, 12:49:18 2,547,469. That is 125,518 removed in 19.1 min = ~6,570/min (~110/s). At that rate the remaining 2.55 M need about 6.5 h (more if few face calls come in; it is ~one 40 ms slice per face call). Whether new files are still being created I cannot see from the count.
  29. Options, none applied:
  30. 1. Wait: needs nothing, ~6.5 h, but the 2.55 M-entry queue stays in the heap and the next restart repeats the 12-33 s blocking listing plus a new 2.5 M queue if the files are still there.
  31. 2. App config only (project.hl / manifest `sessionAnonKeep`, already read in WebFramework.hl line 362): a shorter keep time (anonKeep 3600) does not speed the drain, it only decides which files count as dead; fewer files get skipped by the mtime shortcut. Not a drain fix. There is NO config for `slice` (WebFramework passes no slice to HlwSessions), so a bigger slice needs a hl:web change.
  32. 3. hl:web change (Arachne): (a) call storeSlice also from GET/page requests or from a timer (every(0.1)) with a larger budget (e.g. 20 ms per 100 ms), (b) never hold all entries: list in chunks or keep only a cursor instead of building the 2.7 M array, so the boot cost goes from 12-33 s to a few ms, (c) expose `sessionSlice` in the config.
  33. 4. Operator step (not the app): delete the old files once, with the app running (an `ls`-free `find -mtime +1 -delete` in the store). This is a change on live data and needs Apollo's go. I did not do it.
  34. ## 5. Options for the stalls (no change made)
  35. - Details repair: it is the main cause. It blocks the request loop for 1.5-10.9 s per step and its queue is 65k titles. Options: pause it (TRACKER_REPAIR=0, env, needs a restart), or make each step smaller (TMDB calls as separate steps with the loop yielding between them; that is an app change in lib/jobs.hl completeStep), or run it only at night.
  36. - Person fills from crawlers: stop the crawlers filling people (robots.txt, `Disallow: /person/` is not enough for the disguised ones; a nginx rate limit or a bot UA block for tracker.worldapi.org is the operator's/Atlas's step) or have a person page that is not yet filled show the stored data and queue the fill as a low-priority job.
  37. - GC: run a local copy with HL_GC_STATS=1 to see whether the 100 % runs are collections; HL_GC_PACING=2..4 trades memory for fewer collections (live has 62 GB, 25 used).
  38. - Freeing the 25 GB heap by draining the session queue may shorten every collection.
  39. ## Processes started and stopped
  40. - ssh byrodin sampler (shell reading /proc), local PID 785860: ended on its own after 1000 s.
  41. - probe loop script (scripts/probe.sh), PID 785861: ended after 1000 s.
  42. - ssh docker logs -f for the app, PID 785863, and for nginx `web`, PID 785864: killed by me.
  43. - Local synthetic store (500k files) deleted. Local bench runs (bin/hybriel) all ended. No port was opened.
  44. - Requests: about 33 model requests; the cap was not reached.

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