# Ceilings and regression floors for the gated numbers, set from three 5-run # replay batches on valefar at CI size (12 CPUs, 12 GiB): two with repetitions # concurrent (C, D) and one sequential (S), on e79fc951's recordings. # # ceiling: an absolute limit. Most are about 10% above the highest batch median # (more for small slopes); explicit policy allowances are explained below. # Raising one is a reviewed commit that says why; a rolling baseline alone # would let creep through. # floor: the smallest change vs the baseline that counts as a regression, at # least three times the largest batch MAD and the spread between batch medians. # Byte counts regress at 1% instead of a floor. # Historical movement is reported for diagnosis. Absolute ceilings decide the gate. advisory_drift = true # PR workloads and the absolute ceilings each must satisfy. [required] fan-out = ["idle_session_beam"] pool = ["kernel_forked_anon"] kernel = ["kernel_cell_slope"] long = ["retained_turn_beam", "disk_appended_per_turn"] context = ["context_reductions_per_step_per_mb"] # Empty daemon, private memory. C/D/S: 29.96 / 28.62 / 29.81 MB, MAD <= 0.34 MB; # batch medians differ by 1.3 MB. The tree is the daemon alone at boot, no # kernel or zygote. In CI, the last 40 main pushes (to c515c917) had medians # of 30.1 to 33.1 MB and samples of 29.2 to 34.4 MB, 19 of 200 above 33 MB; # 7d57ec7f's 33.07 MB median was over the old 33.0 MB ceiling. Local boot # replays at d6b969dd, 4c85ea00, eddd8199 and 7d57ec7f (3 rounds of 5 each) # had round medians of 31.06 to 33.69 MB within one commit, all-sample # medians of 31.67 / 32.24 / 32.49 / 32.07 MB, and the same BEAM total # (26.09 to 26.20 MB): USS noise outside the BEAM's own allocations, not # code. The ceiling is about 10% above the 32-33 MB upper medians; the 2 MB # floor against the baseline previously tried to catch growth too. In CI, # b0acb577 and cee4d394 measured 35.20 and 34.80 MB against a 32.27 MB baseline, # while their retained BEAM medians were 26.54 and 26.59 MB. At 4d7385aa USS # returned to 31.75 MB with retained BEAM still 26.59 MB. Keep USS as an absolute # process-footprint bound; boot_beam owns the precise retained-memory comparison. # Five-sample CI replay artifacts: # https://sites.wisp.place/okami.mom/albedo-perf/b0acb57/ # https://sites.wisp.place/okami.mom/albedo-perf/cee4d39/ # https://sites.wisp.place/okami.mom/albedo-perf/4d7385a/ [metrics.boot_tree_uss] kind = "memory" comparison = "absolute" ceiling = 36_000_000 # Retained BEAM at the same empty checkpoint, after major GC and excluding heap # slack and unowned binaries. The five-sample CI replay at 4d7385aa measured # 26,592,448 B, versus 26,532,998 B at f250f763 after the workspace migration. # The 30 MB ceiling bounds retained boot cost independently of USS variation; # baseline noise, 5%, and this floor still bound increases between revisions. # Three unchanged-code five-sample batches at e66ee558, including CPU/disk # stress on Linux 7.3.1 (32 CPUs, 59,475 MiB, two BEAM schedulers), had retained # BEAM medians 26,481,492 / 26,480,996 / 26,481,500 B with MAD <= 648 B. # Command: python3 perf/run.py --mode replay --runs 5 --scenario boot --out FILE # Stress wrapper: python3 test/manual/stress.py # Local artifacts: /tmp/albedo-memory-policy-boot-{1,2,3-stress}.json [metrics.boot_beam] kind = "memory" ceiling = 30_000_000 floor = 1_000_000 # Per idle session (slope over 20 sessions). 315 / 329 / 333 KB, MAD <= 23 KB. [metrics.idle_session_tree_uss] kind = "memory" ceiling = 400_000 floor = 70_000 # BEAM per idle session, without heap slack or binaries no process holds # (robot-docs/perf.md), Theil-Sen slope. Six batches: 209 to 211 KB, MAD # <= 1.2 KB. (Before: 218 to 279 KB, MAD up to 20 KB.) [metrics.idle_session_beam] kind = "memory" ceiling = 235_000 floor = 8_000 # Process memory per turn after warm-up; includes the SQLite writer cache # still filling (robot-docs/perf.md). 16.4 / 11.2 / 10.5 KB, MAD <= 5 KB. # CI's f299ac26 and c0e7fcf0 measured 3,809 and 28,535 B/turn while retained # BEAM stayed at 1,054 and 932 B/turn. These full five-sample replays used # Linux 6.18.35, 10 CPUs and 3915 MiB. A low process-memory batch must not # tighten the leak comparison: unused allocator space and SQLite cache pages # also move this slope. Keep its fixed 32 KB ceiling and use the separately # gated retained_turn_beam for precise retained BEAM growth. # Command: python3 perf/report/ci.py # Reports: https://sites.wisp.place/okami.mom/albedo-perf/f299ac2/ # https://sites.wisp.place/okami.mom/albedo-perf/c0e7fcf/ [metrics.retained_turn_tree_uss] kind = "memory" comparison = "absolute" ceiling = 32_000 # BEAM per turn after warm-up, the precise leak gate, counted like # idle_session_beam. Six batches: 0.3 to 2.0 KB, MAD <= 3.4 KB. [metrics.retained_turn_beam] kind = "memory" ceiling = 16_000 floor = 12_000 # The daemon's (beam.smp) largest turn peak over chat, coding and long, the # turn that starts coding's kernel left out (kernel_start_daemon_uss). It # replaced turn_peak_tree_uss (23.8 / 23.1 / 23.4 MB), which was a cold # kernel's start (16.4 MB) plus the daemon's, plus lazy code loading. # 1.45 to 1.70 MB over five runs, MAD 94 KB (2b617ac4's tree). # Recalibrated from seven five-run CI batches on main, 2026-11-14 (df5f6ef to # 79c89f4): medians 1,613,824 to 2,105,344 B, largest MAD 167,936 B, median # spread 491,520 B. One commit (a5e4d1b) ran twice and gave 1,978,368 and # 1,687,552 B, so the spread is mostly run-to-run and not the code; three of # the seven batches crossed the old 1.9 MB ceiling. The ceiling is 10% above # the highest median; the floor covers the spread and three times MAD. These # are batches across commits, so a small rise from that day's rewrite is not # ruled out. [metrics.turn_peak_daemon_uss] kind = "memory" ceiling = 2_300_000 floor = 510_000 # Sum of allocator-instance high-water marks over the same turns. These maxima # need not coincide, so scheduling changes the upper bound without changing # production code. The original ceiling came from 5.28 to 5.91 MB batches. # Recalibrated the noise floor from three five-run replay batches on unchanged # production code (12 CPUs, 3915 MiB, Linux 6.18.35): medians 5,253,096, # 5,995,912 and 6,399,544 B; largest MAD 215,456 B; median spread 1,146,448 B. # This covers the spread and three times MAD while preserving the ceiling. # Command: python3 test/perf/run.py --mode replay --runs 5 --out /tmp/perf.json # Reports: https://sites.wisp.place/okami.mom/albedo-perf/b708ac1/ # https://sites.wisp.place/okami.mom/albedo-perf/5c7a8a2/ # https://sites.wisp.place/okami.mom/albedo-perf/017d19a/ [metrics.turn_peak_beam_blocks] kind = "memory" ceiling = 6_500_000 floor = 1_200_000 # The context loop: 300 cells in one turn, final request body 1.984 MB. Each # value is per decimal MB of that body. Measured on macOS (OTP 29.1.2, two BEAM # schedulers) through the probe alone, without smaps, in three batches of five # concurrent repetitions after request rendering stopped re-parsing history: # reductions per cell 901,804 / 901,203 / 900,274, MAD <= 732. With the # re-parsing put back: 1,145,271. Reductions count the BEAM's work, so host # load does not move them, and this is the number that catches work that grows # with history; its ceiling is about 10% above the highest batch median. # peak blocks 3.59 / 5.33 / 2.78 MB, MAD <= 1.04 MB: allocator maxima under # concurrency are noisy (single quiet runs: 3.5 MB, and 11.9 MB with the # re-parsing), so this ceiling only bounds gross growth. # kept BEAM 1.32 / 1.31 / 1.03 MB, MAD <= 0.11 MB. # Floors cover three times the largest MAD and the spread between batch # medians. Only the reductions ceiling blocks: the other two stay advisory # until Linux CI records calibrate them. Re-derive all three then. # Linux: python3 perf/run.py --mode replay --runs 5 --scenario context --out FILE [metrics.context_reductions_per_step_per_mb] kind = "memory" ceiling = 1_000_000 floor = 5_000 [metrics.context_peak_beam_blocks_per_mb] kind = "memory" ceiling = 5_900_000 floor = 3_200_000 [metrics.context_retained_beam_per_mb] kind = "memory" ceiling = 1_460_000 floor = 330_000 # context's peak/retained daemon USS per MB and wall milliseconds per step are # diagnostic in scenarios.context.context. The first Linux CI records must set # their ceilings; macOS has no comparable smaps counters or CI wall calibration. # The daemon's peak during the turn that starts coding's kernel. # 5.59 to 6.25 MB, MAD 127 KB. [metrics.kernel_start_daemon_uss] kind = "memory" ceiling = 7_000_000 floor = 700_000 # Mean request bytes per long turn; identical in every run (48,704 B). [metrics.request_bytes_per_turn] kind = "bytes" ceiling = 53_600 floor = 0 # Request growth per turn; identical in every run (235 B). [metrics.request_bytes_slope] kind = "bytes" ceiling = 300 floor = 0 # Long session hydration (tail 200). 72,898 / 72,939 / 73,059 B. [metrics.attach_bytes] kind = "bytes" ceiling = 80_000 floor = 0 # Kernel gates count anonymous memory (Pss_Anon): pages a fork still shares # with its zygote count once between them, and libpython's text is not # private just because no other process maps it (USS read 11 MB for a bare # interpreter alone, 4.9 MB beside another). kernel_rest_uss (16.33 MB USS) # was retired with this change. # The session's kernel after its first cell. # 16.42 MB in every run. [metrics.kernel_rest_anon] kind = "memory" ceiling = 18_000_000 floor = 500_000 # Every Python process after the first cell: the kernel and any zygote or # spares it brought, the whole cost of a daemon's first kernel. # 16.42 MB in every run: a cold launch, no zygote. [metrics.kernel_first_anon] kind = "memory" ceiling = 18_000_000 floor = 500_000 # A kernel forked from the zygote, adopted by pool's second session. # 8.66 to 8.68 MB. Since 4de2d000 the adopted kernel checkpoints its resting # namespace before it is measured: 9,190,400 -> 9,607,168 B in CI. Preloading # pickle in the zygote (albedo_state.py) takes about 205 KB of that back # (9,625,600 -> 9,420,800 B in a local replay); the rest is the save itself. # The locked kernel environment adds dill at e66ee558. Loading it only after # adoption measured 11,255,808 B in CI at f299ac26. Preloading the selected # serializer before the zygote's freeze shares its imported objects. Two local # five-sample batches using 91691972 plus serializer preloading, on Linux 7.3.1 # (32 CPUs, 59,475 MiB), one under CPU/disk # stress, both measured 10,079,232 B; largest MAD 1,024 B. Use a fixed 10.5 MB # footprint cap for the default serializer environment. This still rejects the # unshared imports. Per-cell growth is checked separately; this absolute PSS # cost also depends on the fixture's sharing cohort and is not a leak slope. # Command: python3 perf/run.py --mode replay --runs 5 --scenario pool --out FILE # Stress wrapper: python3 test/manual/stress.py # Artifacts: /tmp/albedo-perf-kernel-preload-pool{,-stress}.json # CI artifact: https://sites.wisp.place/okami.mom/albedo-perf/f299ac2/ [metrics.kernel_forked_anon] kind = "memory" comparison = "absolute" ceiling = 10_500_000 # Kernel memory kept per cell over 30 cells after warm-up. 7.8 / 8.0 / 8.1 KB, # MAD <= 0.3 KB, as USS; main has measured 5.0-6.9 KB since. Read from Pss_Anon # plus SwapPss since 3f97c9e9 read -259 KB: its runner swapped the kernel out. [metrics.kernel_cell_slope] kind = "memory" ceiling = 12_000 floor = 2_000 # Zygote and spares left at rest. 0 in every run; a lingering zygote is ~19 MB. [metrics.kernel_pool_pss] kind = "memory" ceiling = 4_000_000 floor = 1_000_000 # Disk writes: /proc//io write_bytes less cancelled_write_bytes over the # daemon's process tree (robot-docs/perf.md). Page counts, so regressions use # the floor and the baseline's noise without a percentage share. # Empty home to the first checkpoint: schema creation and the fixture's # provider profile. 1,589,248 B in nine of ten batches with MAD 0, but # 1,683,456 in one (N), so the floor only catches a step past that. On main # with session_prompts (402a7545): 1,605,632 B (P). The store now backfills # up to 30 s after a commit; boot waits for it, 1,650,688 B in A and B. # The /cd move's ledgers (transfers, transfer_occurrences, moves, # move_occurrences), created with the core schema in its one commit: +49 KB, # six root pages and a schema page, WAL plus backfill; 1,781,760 B in CI # (abf1651e, MAD 0). Mail forwarding's ledgers (mail_remote, mail_outbox and # two indexes, mail_peers, family_remote), created in the core schema commit: # six root pages and two sqlite_schema pages from a leaf split, each a WAL # frame and backfilled: 1,839,104 B on valefar (+57 KB). The unified inbox's # mail_key index (mail.gleam), one root page, a WAL frame and its backfill: # +8 KB, 1,892,352 B in CI (3692dc90, MAD 0). Crash tolerance (4de2d000) # adds the session_side_questions table and its primary-key index (two new # root pages, each a WAL frame and a backfilled page) and two more WAL frames # of pages the database already has (the migration row session_titles now # records lands in one): +16,480 B of WAL and +8,192 B of # database writes in a local replay, 1,921,024 -> 1,945,600 B in CI (+24,576, # MAD 0). # 671de6cd moved extension reads of core tables onto typed operations: a fresh # home now creates the mail indexes those reads page through (the undelivered # index and the two partial key indexes webhooks files letters under), the # webhook delivery indexes (received, per-hook, per-session) and the # webhook_upgrades bookkeeping table, each a new root page written to the WAL # and backfilled: 1,945,600 -> 2,011,136 B in CI (+65,536, MAD 0). The ceiling # leaves the same ~24 KB of headroom the previous raise left, plus room for the # opt-in checklist extension's table and index (00a16763), which install # creates even when it is not enabled. # c12043d4 added the downgrade guard: a fresh home creates the # breaking_migrations table and its primary-key index and records each # breaking migration it runs (five today) before running it, each record its # own commit: 2,027,520 -> 2,125,824 B in CI (+98,304, MAD 0). No backup is # copied on a fresh home (it has no record yet), so this is the whole cost. # After the workspace migration, all five CI samples at 21b18cbc measured # 2,289,664 B (MAD 0). Accept this measured boot cost with about 40 KB of # headroom; the 200 KB regression floor is unchanged. This calibration does # not attribute the increase to a particular schema or build change. # The next links migration (cee4d394) adds link_migration_conflicts and migration # bookkeeping: all five CI samples at 4d7385aa measured 2,347,008 B, up 28,672 B # from b0acb577. A fresh home's schema cost grows as supported migrations and # tables accumulate. Set an explicit 3 MB initialization allowance instead of # repeatedly leaving only a few WAL pages of headroom. This is a policy bound, # not a noise calibration. The 200 KB regression floor still catches large # increases; steady-state turn, append, backfill and idle limits are separate. # Replay artifact: https://sites.wisp.place/okami.mom/albedo-perf/4d7385a/ [metrics.disk_written_boot] kind = "disk" ceiling = 3_000_000 floor = 200_000 # Median turn of long after warm-up, the home flushed between turns. # I/J/K/L/M/N: 487 / 500 / 500 / 492 / 494 / 498 KB, MAD <= 6 KB. WAL frames # (4,120 B) straddle pages, so a few bytes more content per turn moves this # by pages; disk_appended_per_turn is the precise number. session_prompts # (402a7545) took it to 319,488 B in every run of P. [metrics.disk_written_per_turn] kind = "disk" ceiling = 352_000 floor = 20_000 # Bytes write calls give every file but albedo.sqlite per long turn after # warm-up: WAL frames, logs, state files (writes_shim.c). Checkpoint copies # into the database are left out because their timing varies. 275,866 to # 275,869 B in every run of three batches (L, M, N); 181,312 to 181,314 # after session_prompts (P). CI's main-push records then step to 190,655 B # (the typed sizing and receipt batch before 31aed0fa2, which stores # measured sizes per turn) and to 199,729 B (35f7c4a4e, whose trigram index # is written with each turn's text). From 199,719 B on main since, single # runs read 198,895 to 200,650 B, the spread a CI job's own environment # gives every run in it: bcc776335 read 200,646 to 200,650 B, and the # test-only commit after it 199,719 B. The 200,000 B ceiling set at 181 KB # had 0.1% left and failed bcc776335 on that spread alone, so the ceiling # keeps the 10% margin it was set with; the baseline comparison (floor # 2,000 B) still catches a step like either of those. [metrics.disk_appended_per_turn] kind = "disk" ceiling = 220_000 floor = 2_000 # One scaled hour of idle: 0 / 0 / 0 / 147 KB medians, single runs 0 to 180 KB, # all in the first scaled minute (the held kernel's release). A file rewritten # every 10 s read 1.68 MB. Since the WAL backfill waits up to 30 s, the hour # starts once the turns before it are backfilled: A / B 94 / 143 KB, all in the # first scaled minute; the 10 s rewrite read 1.63 MB (T), `home/touched` named. [metrics.disk_written_idle_hour] kind = "disk" ceiling = 400_000 floor = 200_000 # Bytes checkpoints copy into albedo.sqlite per long turn after warm-up, both # ends of the window waiting for the backfill (writes_shim.c). The store # backfills 30 s after a commit, so this counts a page once per its turns in # that span: batches A / B medians 13.3 / 10.5 KB, runs 10.5 to 13.3 KB. Backfilling after every turn # would copy every page each turn rewrites. [metrics.disk_backfilled_per_turn] kind = "disk" ceiling = 20_000 floor = 4_000