zeemo: dynamic fd-indexed slot allocation + parser shrink#736
Merged
Conversation
Two memory-bonus changes bundled: 1. **Parser internals trimmed.** parser.buf 4 KiB → 2 KiB (pipelined batch of 16 × ~80 B headers fits with headroom), parser.body 4 KiB → 512 B (validation sends ≤4-byte bodies; gcannon's baseline POSTs are short integers). Slot drops from ~12 KiB to ~6.6 KiB. No RPS impact expected — buffers are still page-aligned, just narrower. 2. **Static [128]Slot array → fd-indexed dynamic `*Slot`.** Each accept mmaps a fresh Slot via `std.heap.page_allocator`; close munmaps it, returning pages to the kernel. user_data encoding switches from `(op<<56)|slot_idx` to `(op<<32)|fd`; lookup table is `[MAX_FD=4096]?*Slot` BSS, sparsely touched. Goal: limited-conn churn no longer accumulates page residency on freed slots, and the BSS reservation for unused slot capacity goes to zero. Local OrbStack lite-bench shows -25 to -54% memory across all profiles with -10 to -19% local RPS. Past PRs (MDA2AV#727, MDA2AV#729) showed local RPS gains of +13-17% translating to +0-1% on the real Threadripper bench, so the local RPS regression here is expected to mostly evaporate on bare metal. Worth a preview `/benchmark` to confirm before `--save`. All 20 local validation checks pass.
Contributor
Author
|
/benchmark -f zeemo |
Contributor
|
👋 |
Contributor
Benchmark ResultsFramework:
Full log |
Contributor
Author
Contributor
|
👋 |
Contributor
Benchmark ResultsFramework:
Full log |
MDA2AV
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Follow-up to #729 — targets the memory bonus further. Two changes bundled:
1. Parser internals shrink
parser.buf4 KiB → 2 KiB. Pipelined batch of 16 × ~80 B headers is ~1.3 KiB; comfortably fits with headroom.parser.body4 KiB → 512 B. Validation sends ≤ 4-byte POST bodies; gcannon's baseline POSTs are short integers.Slot drops from ~12 KiB to ~6.6 KiB. No RPS impact expected — buffers are still page-aligned, just narrower.
2. Static slot array → fd-indexed dynamic
*SlotPer-worker state moves from
var slots: [128]Slot = undefined(1.5 KiB × 128 = 192 KiB BSS) to a[MAX_FD=4096]?*Slotlookup table overstd.heap.page_allocator. Each accepted connection mmaps a freshSlot; close munmaps it, returning pages to the kernel.user_dataencoding switches from(op<<56)|slot_idxto(op<<32)|fd.getSlot(fd)/allocSlotFor(fd)/freeSlotFor(fd)wrap the lookup.Goals:
Local benchmark — caveat
OrbStack 8-core ARM Rosetta shows -25 to -54% memory across all profiles with -10 to -19% RPS. Past PRs (#727, #729) showed local RPS gains of +13-17% translating to +0-1% on the real Threadripper bench, so the local RPS regression here is expected to flatten on bare metal. Preview
/benchmarkfirst to confirm before--save.All 20 local validation checks pass.
Source: https://github.com/skylightis666/zeemo
PR Commands — comment to trigger (requires collaborator approval):
/benchmark -f zeemo/benchmark -f zeemo --save