Public: anyone can read this; the crew can change it.
A small forge reads its pictures on its own thread until one is slow, so an idle forge holds half the memory #16846
Juniper asked for changes (review 01m8q55kzxa24s4pscp782vpjp)
Phase D1 of #16840 (hosting at every scale). Memory per awake forge sets how many forges a machine holds. Measured on a fresh forge (macOS arm64, Bun 1.4.4): idle 396 → 210 MB, after 150 requests 400 → 218 MB, idle CPU 1.3% → 0.5%.
-
Reviews
Changes requestedThe idea is right: a small forge shouldn't pay about 100 MB for each of two idle workers. I'm requesting changes on tests and on one lock-up risk. I didn't change or run anything.
- The new placement wiring has no test.
test/idle-memory.test.tsunit-testson_thread.ts, but nothing covers the branches added tolanes.tsandpages.ts. Nothing shows that a cheap reading stays on the forge's thread and starts no worker, or that a slow reading moves later readings to the worker.pages-worker-retiresetsunderMs = -1to avoid the new path, so no existing test reaches it. Add a pages test and a lanes test that fail if the branches are removed. - The idle-memory test can flake. The Linux budget of 480 MB is a guess. The test's own comment says small Linux forges read 580-630 MB before this change, and that the budget is lowered once a runner reports. It also relies on a 15 s real sleep and a
psRSS reading, and the forge's own check runs it on Linux. Measure on the check runner and set the budget from that number, or drop the Linux entry until it is measured. A test that passes on a guess and fails under load is the flaky test the direction forbids. - The first slow reading locks the forge's thread.
readHereonly learns a reading is slow after it has finished, and that reading ran on the event loop. On a forge that is already large, the first reading of a kind may block/and/healthzfor seconds. That is the forge-locks-up Never. Start the worker at boot when the forge's database is already large, or use a cheap size signal before the first thread read. At least cover the blocking case with a test. - Small points. In
lanes.ts, put the./on_thread.tsimport after the../imports to match the file's order. ThereadPlacementmutable global is mutated by tests and never restored on failure; use try/finally, or restore it inafterAllin every file that sets it.
No UI or docs change was needed, so I found nothing to add for the terminal door or
docs/features/. - The new placement wiring has no test.
-
Checks
look green — its preview answered, ready for a look deploy 0b749de
Check passeddeploy 0b749de
Website spec: 25 findings (report only)
- /board http://127.0.0.1:40497/board answered 303 — https://specification.website/
- /notes http://127.0.0.1:40497/notes answered 303 — https://specification.website/
- /review http://127.0.0.1:40497/review answered 303 — https://specification.website/
- /system http://127.0.0.1:40497/system answered 303 — https://specification.website/
- /admin/limits http://127.0.0.1:40497/admin/limits answered 404 — https://specification.website/
- /maintenance http://127.0.0.1:40497/maintenance answered 303 — https://specification.website/
- /talk http://127.0.0.1:40497/talk answered 303 — https://specification.website/
- /flow http://127.0.0.1:40497/flow answered 303 — https://specification.website/
- /resilience http://127.0.0.1:40497/resilience answered 303 — https://specification.website/
- /boards?help http://127.0.0.1:40497/boards?help answered 303 — https://specification.website/
- /settings/crew http://127.0.0.1:40497/settings/crew answered 303 — https://specification.website/
- /settings/crew?help http://127.0.0.1:40497/settings/crew?help answered 303 — https://specification.website/
- /settings/captain http://127.0.0.1:40497/settings/captain answered 303 — https://specification.website/
- /settings/security/controls http://127.0.0.1:40497/settings/security/controls answered 303 — https://specification.website/
- /settings/grants http://127.0.0.1:40497/settings/grants answered 303 — https://specification.website/
- /preview-admin/sample expected exactly one <h1>, found 2 — headings
- /preview-admin/sample/drop http://127.0.0.1:40497/preview-admin/sample/drop answered 303 — https://specification.website/
- /preview-admin/sample/data-move http://127.0.0.1:40497/preview-admin/sample/data-move answered 303 — https://specification.website/
- /preview-admin/sample/cut-over http://127.0.0.1:40497/preview-admin/sample/cut-over answered 303 — https://specification.website/
- /preview-admin/sample/next?pick expected exactly one <h1>, found 2 — headings
- /preview-admin/sample/bets expected exactly one <h1>, found 2 — headings
- /preview-admin/sample/waves expected exactly one <h1>, found 2 — headings
- /preview-admin/sample/space the first focusable element is not a skip link (an in-page #target link) — skip-link
- /looks/missing http://127.0.0.1:40497/looks/missing answered 404 — https://specification.website/
- /looks/failed http://127.0.0.1:40497/looks/failed answered 500 — https://specification.website/
This pull asks for more cpus. Its preview and check run at the size main declares; the larger size applies when the pull lands.
4 earlier comments
Parked, offered to the crew again: it sat 6 h with no push, and nobody on the crew can take it from here (a person's branch: no builder can push it), so it waits for its author. The last verdict (changes requested): The idea is right: a small forge shouldn't pay about 100 MB for each of two idle workers. I'm requesting changes on tests and on one lock-up risk. I didn't change or run anything. 1. The new placement wiring has no test. test/idle-memory.test.ts unit-tests on_thread.ts, but nothing covers t… (The forge posts this; nobody wrote it by hand.)
Answered for #17832, left as it is.
State: changes requested: juniper's notes on src/flow/lanes.ts and src/flow/pages.ts (untested branches, a first read that blocks).
Why not finished: this pull is trevato's own, a person's branch. #17832 lets a builder rebase, fix or apply reviews only on the crew's own pulls, so the crew does not push here. To hand it to the crew, give it back (or open an issue that names it), and a builder takes it from there. Nothing was merged or closed.
Phase D1 of #16840 (hosting at every scale). Memory per awake forge sets how many forges a machine holds.
Measured on a fresh forge (macOS arm64, Bun 1.4.4): idle 396 → 210 MB, after 150 requests 400 → 218 MB, idle CPU 1.3% → 0.5%. Cold start is unchanged.
Where it went: the pages and lanes Workers started at boot each loaded about 2,458 modules (around 100 MB each). The new src/flow/on_thread.ts reads each kind of picture on the forge's thread through the worker's own code path. The first reading over 50 ms moves that kind to its worker for the rest of the process. So a small forge never starts them, and a big one moves after one slow reading.
test/idle-memory.test.ts boots main.ts and holds the idle RSS under a budget (350 MB on darwin, 480 MB on linux, to be lowered once a Linux runner reports).
🤖 Generated with Claude Code