Heavy16 with a 1.5B heartbeat turn

Replacing Reactor's timer/self-call pump with heartbeat saved 0.80% complete instructions, but completion took 6.15% longer in this matched run. It also introduced a recurring idle cost. The instruction improvement is retained as an experiment; this is not a throughput win or a production scheduler selection.

The later requested 500M heartbeat run uses the same Wasm with a smaller runtime cutoff: 385.831B instructions and 49.2 simulated seconds. It is slower and more instruction-expensive than this 1.5B run.

Implementation is committed separately at d52a47897b58b1b2f4145ee74cdf679e31737c27, branch experiment/reactor-heartbeat-1500m, worktree rrt/tmp/perf-round10/worktrees/reactor-heartbeat. Main's implementation is unchanged. Implementation notes describe the replacement; IC review and independent receipt record source, build and trace checks.

Matched workload

One full run per artifact: 16 same-subnet canisters, 18,000 individual ingress requests offered at 1,000/s over 30 simulated 600 ms rounds. Both use the 1,500,000,000 instruction soft cutoff, ordinary IC instruction limits/DTS, 1,024-item/1.9 MB peer batches, concurrency 4,096 and 40 callback units. The candidate changes the scheduling producer; workflow graphs, transport, queue admission and cleanup remain the same. It includes the merged compact ingress.

Instructions sum completed replicated updates, heartbeats/timers and callbacks through publication, transport and reclamation drain. Setup, inspection and read-only diagnostic queries are excluded. The host tracer does not emit aborted DTS attempts; neither run reported traps. Included heap page charges are already part of instructions, not an extra amount to add. The residual is not a pure CPU metric. Throughput uses simulated completion time, not host wall time; one run per artifact does not establish a distribution.

Complete Heavy16 Timer/self-call Heartbeat
Instructions 373.418B 370.417B
Included heap page instructions 55.584B 53.075B
Remaining instructions 317.833B 317.342B
Replicated executions 23,323 22,331
Primary + maintenance rounds 65 + 0 68 + 1
Complete simulated time 39.0 s 41.4 s
Endpoint messages/s 4,615.38 4,347.83
Blocks/s 707.69 666.67
Root receipt-to-completion p50 / p95 / max 12.0 / 22.8 / 32.4 s 16.8 / 24.6 / 34.8 s
Durable queue delay p50 / p95 / max 1.2 / 3.0 / 4.8 s 0.6 / 3.6 / 3.6 s
Peer batch calls 1,708 1,933
Scheduler turns 486 448
Mean complete ingress instructions 1,069,529 1,038,021
Mean ingress accessed / dirty 64 KiB regions 7.56 / 5.54 7.36 / 5.35
Wasm capacity after drain, all 16 614.56 MiB 652.38 MiB
Stable capacity after drain, all 16 1.00 MiB 1.00 MiB
Observed cycles, separately from instructions 919.446B 908.317B

Root latency starts when the canister receives and stores the request; it does not include waiting in the IC ingress queue. Memory is grown capacity, not live application bytes. Heartbeat's extra tail was 16 entries costing 9.06M instructions and is included above.

Both completed 19,200 workflows (18,000 roots + 1,200 children), 594,000 visits, 202,800 task attempts, 180,000 endpoint messages and 27,600 blocks. All 360,000 offered wire frames were accepted without reoffers. There were no ingress rejections or observed traps. All 16 certified tips were 1,724; 1,024 typed block samples passed. All workflow/transport queues, callbacks, permits, immediate readiness and observed reclamation debt drained.

Where the difference appears

Execution group Timer count Timer instructions Heartbeat count Heartbeat instructions
Ingress start 18,000 19.252B 18,000 18.684B
Peer reactor_receive 1,708 20.029B 1,933 19.838B
Reply callbacks 2,445 6.028B 1,933 5.612B
Global timer 433 0.349B 0 0
Timer executor 639 227.422B 0 0
reactor_turn self-call 98 100.338B 0 0
Heartbeat 0 0 465 326.283B

The timer executor and reactor-turn rows contain the real workflow work; their entire cost is not scheduling overhead. Heartbeat moves that work into its own entry. It removes 737 timer-executor/turn response callbacks, while the changed schedule produces 225 more peer calls. Consequently this comparison cannot isolate a self-call fee. About 84% of the 3.00B instruction saving is the reduction in the included heap-page component. The large non-page component barely changes, consistent with executing the same scheduler and drivers.

The largest completed heartbeat used 1,512,767,509 instructions. The 1.5B threshold is cooperative: a driver step and SDK executor-exit work can overshoot it. Heartbeats follow IC scheduling; they are not guaranteed once in every busy round. All 18,000 ingress entries still accessed and dirtied exactly one packed payload page; the larger whole-entry page counts also include SDK/scratch and other metadata.

Idle cost

The separate idle probe installs one empty canister, commits one untimed ordinary update, lets startup drain for five rounds, then measures ten quiet 600 ms rounds. State and scheduler turn counts stay unchanged throughout.

Per idle canister round Timer Heartbeat
Executions 0 1
Instructions 0 481,079
Included heap page instructions 0 480,000
Accessed / dirty 64 KiB regions 0 / 0 3 / 3
Observed cycles 0 5,962,158

The cached no-work path avoids running scheduler drivers, but SDK entry/exit still touches three regions. This is measured on an empty canister, not a fixed cost to subtract from populated workloads. Results and compressed traces are in idle control and idle heartbeat. A pre-warmup control observation in idle-control-r2/before.json is retained for follow-up, not used as this baseline or presented as a diagnosed startup bug.

Evidence and scope

The canonical Wasm is 4,709,285 bytes, SHA-256 e18ec43f207b6199d901a330c1a89ad1098dacf880a29121c2ef2a878c018555. It exports heartbeat and lacks reactor_turn; unrelated SDK timer exports remain but do not execute in this run. The qualified timer control is 325e1dbab236f5028cc44cd7c5530facf08edbdeb339c4e3e3f545523f4b16d4. Both use the pinned traced PocketIC binary 1fc9e6f58f7b329a0deb0c1944306a74625293fa56decf9df653ba8ec41fa45c.

Focused native tests passed (42 unit, one composition, two compile-fail docs). The fresh canonical build took 143.56 host seconds; Heavy16 took 155.15 host seconds. Source guards, packaging checks and independent raw-trace/hash review passed. Compact build evidence is in build/; exact run commands and raw locations are in candidate/. Recompute the matched summary:

python3 research/experiments/2026-10-20-reactor-heartbeat/verify.py

This qualifies the isolated successful-workload experiment. Actual heartbeat trap recovery and retained KEEP upgrades were not separately exercised, and unrelated Chat/manual-probe controller consumers were not ported. Main's scheduler, benchmark defaults and kernel contract are unchanged. The live trace viewer, while the shared server is running, is on port 8090, instance 16.