[GH-ISSUE #3989] Server next: plan and progress (docs/server-next.md) #1167

Open
opened 2026-11-02 15:44:45 +07:00 by bsakaguchi · 16 comments
Owner

Originally created by @ludovic111 on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3989

🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself.

Tracking issue for the next server, designed in docs/server-next.md (#3984). The bar, set by Ludovic: beat Pumpkin on
every measured number, and stay vanilla-exact. Measured with the same horizon-bots load:

  • players at 20 TPS;
  • MSPT p99;
  • RSS at 100 players, and at idle;
  • bytes per chunk;
  • join time;
  • time to ready.
Number Horizon (2026-10-29) Pumpkin 0.2.1 Target
Players at 20 TPS 50 50 200 on 8 cores
MSPT p99 at 100 players 108 ms 231 ms < 35 ms
RSS at 100 players 2.05 GB 1.42 GB < 1 GB
RSS idle 760 MB 32 MB < 32 MB
Ready 9–14 s 0.1–0.2 s < 0.1 s
Join p99 244 ms 494 ms < 300 ms
Bytes, Horizon clients 3.7 KB/chunk 3.6 KB/chunk −50 % (fast path)

Workstreams W0–W9 are in section 9.1. Each PR:

  • stays under ~500 lines;
  • carries an A/B from the bench and its harnesses;
  • gets a 🤖 Agent: comment here.

PRs from contributors listed in appendix A come first; we build on them, never duplicate them.

Issues anyone can take: #3971–#3976. Plugin API (W9): levzzz5154 leads.

Originally created by @ludovic111 on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3989 > 🤖 Filed by Ludovic's AI agent (Claude), not by Ludovic himself. Tracking issue for the next server, designed in `docs/server-next.md` (#3984). The bar, set by Ludovic: beat Pumpkin on every measured number, and stay vanilla-exact. Measured with the same `horizon-bots` load: - players at 20 TPS; - MSPT p99; - RSS at 100 players, and at idle; - bytes per chunk; - join time; - time to ready. | Number | Horizon (2026-10-29) | Pumpkin 0.2.1 | Target | |---|---|---|---| | Players at 20 TPS | 50 | 50 | 200 on 8 cores | | MSPT p99 at 100 players | 108 ms | 231 ms | < 35 ms | | RSS at 100 players | 2.05 GB | 1.42 GB | < 1 GB | | RSS idle | 760 MB | 32 MB | < 32 MB | | Ready | 9–14 s | 0.1–0.2 s | < 0.1 s | | Join p99 | 244 ms | 494 ms | < 300 ms | | Bytes, Horizon clients | 3.7 KB/chunk | 3.6 KB/chunk | −50 % (fast path) | Workstreams W0–W9 are in section 9.1. Each PR: - stays under ~500 lines; - carries an A/B from the bench and its harnesses; - gets a `🤖 Agent:` comment here. PRs from contributors listed in appendix A come first; we build on them, never duplicate them. Issues anyone can take: #3971–#3976. Plugin API (W9): levzzz5154 leads.
Author
Owner

@ludovic111 commented on GitHub (Oct 29, 2026):

🤖 Agent: #4009, §7 step 2: the dedicated server builds only the font atlas, as the integrated server does. Idle RSS 836 → 771 MB, ready 5.05 → 4.32 s (median of 3 interleaved runs). Next: the client-only render tables still loaded on a dedicated server (assets reload, block-entity render, animate/fog/music/ambient tables).

<!-- gh-comment-id:6509595905 --> @ludovic111 commented on GitHub (Oct 29, 2026): 🤖 Agent: #4009, §7 step 2: the dedicated server builds only the font atlas, as the integrated server does. Idle RSS 836 → 771 MB, ready 5.05 → 4.32 s (median of 3 interleaved runs). Next: the client-only render tables still loaded on a dedicated server (assets reload, block-entity render, animate/fog/music/ambient tables).
Author
Owner

@ludovic111 commented on GitHub (Oct 29, 2026):

🤖 Agent: W4 (§7 step 2), second PR: #4027 (stacked on #4009). A dedicated server no longer lays out the block sprites' pixels or animation frames, which only the renderer reads. sn_idle, 3 interleaved pairs against #4009: idle RSS 784 → 716 MB (median), ready 4.10 → 3.14 s. With #4009: 836 → 716 MB, 5.05 → 3.14 s from main.

<!-- gh-comment-id:6510224147 --> @ludovic111 commented on GitHub (Oct 29, 2026): 🤖 Agent: W4 (§7 step 2), second PR: #4027 (stacked on #4009). A dedicated server no longer lays out the block sprites' pixels or animation frames, which only the renderer reads. sn_idle, 3 interleaved pairs against #4009: idle RSS 784 → 716 MB (median), ready 4.10 → 3.14 s. With #4009: 836 → 716 MB, 5.05 → 3.14 s from main.
Author
Owner

@ludovic111 commented on GitHub (Oct 29, 2026):

🤖 Agent: W4 (§7), third PR: #4078. Block entity rendering reuses the mesh tables' face visibility instead of loading it and its face shapes a second time. sn_idle, 4 interleaved pairs against main c3071c7b6: idle RSS 852 → 823 MB (median). Also measured and not opened: freeing the chunk workers' density scratch after 5 s idle drops the live heap by 49 MB, but macOS keeps the freed pages in RSS (unchanged within noise), so W4 goes on by not allocating rather than freeing later.

<!-- gh-comment-id:6511136520 --> @ludovic111 commented on GitHub (Oct 29, 2026): 🤖 Agent: W4 (§7), third PR: #4078. Block entity rendering reuses the mesh tables' face visibility instead of loading it and its face shapes a second time. sn_idle, 4 interleaved pairs against main c3071c7b6: idle RSS 852 → 823 MB (median). Also measured and not opened: freeing the chunk workers' density scratch after 5 s idle drops the live heap by 49 MB, but macOS keeps the freed pages in RSS (unchanged within noise), so W4 goes on by not allocating rather than freeing later.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4 (§7), fourth PR: #4092. Worldgen binds the feature block tags once, shared by decoration, structures and live features (they were bound three times, 5.5 MB each). Malloc allocated bytes 30 s after start: 538.7 → 527.3 MB (2 runs each, ±0.5 MB). Idle RSS on the busy Mac mini swings ±70 MB for the same binary, so small memory PRs report allocated bytes; idle-RSS medians are only used above ~25 MB.

<!-- gh-comment-id:6511588416 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4 (§7), fourth PR: #4092. Worldgen binds the feature block tags once, shared by decoration, structures and live features (they were bound three times, 5.5 MB each). Malloc allocated bytes 30 s after start: 538.7 → 527.3 MB (2 runs each, ±0.5 MB). Idle RSS on the busy Mac mini swings ±70 MB for the same binary, so small memory PRs report allocated bytes; idle-RSS medians are only used above ~25 MB.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4 (§7), fifth PR: #4117. The server's packets (ServerAdvancements) and the game's criteria now share one advancement tree (Tree::shared), instead of each parsing the files. Malloc allocated bytes: 538.4 → 530.9 MB in steady runs (−53k live allocations). Running total measured per PR for #4009 + #4027 + #4078 + #4092 + #4117: about −180 MB idle (65 + 68 + 30 + 12 + 7.5) against 836 MB on main; not yet measured together.

<!-- gh-comment-id:6512392508 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4 (§7), fifth PR: #4117. The server's packets (ServerAdvancements) and the game's criteria now share one advancement tree (Tree::shared), instead of each parsing the files. Malloc allocated bytes: 538.4 → 530.9 MB in steady runs (−53k live allocations). Running total measured per PR for #4009 + #4027 + #4078 + #4092 + #4117: about −180 MB idle (65 + 68 + 30 + 12 + 7.5) against 836 MB on main; not yet measured together.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4 idle RSS measured on playhorizon (Linux, 8 vCPU EPYC, the bench pinned to CPUs 0-3 with --exclusive via tools/remote.sh). Same flags for every binary (--profile fast --no-default-features, the server build). Each step is a cumulative merge onto main 6d5915897 (branch bench/sn-w4-ladder). sn_idle.py: fresh scratch server, seed 12345, nobody on, RSS 15 s after the first status ping, 3 interleaved rounds.

step RSS idle (3 runs) median step gain ready (median)
main 621 / 619 / 592 619 MB 4.53 s
+ #4009 font atlas only 537 / 540 / 521 537 MB −82 4.35 s
+ #4027 no sprite pixels 510 / 485 / 509 509 MB −28 4.34 s
+ #4078 shared face visibility 496 / 495 / 497 496 MB −13 4.21 s
+ #4092 feature tags once 487 / 494 / 487 487 MB −9 4.17 s
+ #4117 advancement tree once 486 / 478 / 478 478 MB −9 4.16 s
+ idle worker scratch freed (new PR) 408 / 407 / 406 407 MB −71 4.04 s

All six together: 619 → 407 MB (−34 %). On Linux, glibc gives freed large blocks back at once, so freeing the chunk workers' density scratch after 5 s idle lowers RSS by 71 MB; on macOS it doesn't. From here, W4 is measured on playhorizon, with vmmap allocated bytes on the Mac mini as the quick signal. Next: what is still loaded but never used while nobody is on.

<!-- gh-comment-id:6512873232 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4 idle RSS measured on playhorizon (Linux, 8 vCPU EPYC, the bench pinned to CPUs 0-3 with `--exclusive` via `tools/remote.sh`). Same flags for every binary (`--profile fast --no-default-features`, the server build). Each step is a cumulative merge onto main 6d5915897 (branch `bench/sn-w4-ladder`). `sn_idle.py`: fresh scratch server, seed 12345, nobody on, RSS 15 s after the first status ping, 3 interleaved rounds. | step | RSS idle (3 runs) | median | step gain | ready (median) | |---|---|---|---|---| | main | 621 / 619 / 592 | 619 MB | | 4.53 s | | + #4009 font atlas only | 537 / 540 / 521 | 537 MB | −82 | 4.35 s | | + #4027 no sprite pixels | 510 / 485 / 509 | 509 MB | −28 | 4.34 s | | + #4078 shared face visibility | 496 / 495 / 497 | 496 MB | −13 | 4.21 s | | + #4092 feature tags once | 487 / 494 / 487 | 487 MB | −9 | 4.17 s | | + #4117 advancement tree once | 486 / 478 / 478 | 478 MB | −9 | 4.16 s | | + idle worker scratch freed (new PR) | 408 / 407 / 406 | **407 MB** | −71 | 4.04 s | All six together: 619 → 407 MB (−34 %). On Linux, glibc gives freed large blocks back at once, so freeing the chunk workers' density scratch after 5 s idle lowers RSS by 71 MB; on macOS it doesn't. From here, W4 is measured on playhorizon, with vmmap allocated bytes on the Mac mini as the quick signal. Next: what is still loaded but never used while nobody is on.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: the "idle worker scratch freed" step of the ladder above is #4142 (−71 MB idle RSS on Linux).

<!-- gh-comment-id:6513010948 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: the "idle worker scratch freed" step of the ladder above is #4142 (−71 MB idle RSS on Linux).
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: robustness against one abusive client (after W4), measured in #4179 on playhorizon: teleport floods are kicked at once, chunk-ack floods are clamped, and moves into unloaded chunks are refused. The one real hole was the unbounded per-player inbox: 10 000 packets a tick grew the server by about 1 GB a minute. #4185 caps it (RSS 1937–1960 → 963–1039 MB under that flood; the flooder is kicked 2 s after joining). #4181 adds the abusive behaviours to horizon-bots. Next: costlier packet types (use-item, clicks, suggestions).

<!-- gh-comment-id:6515293671 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: robustness against one abusive client (after W4), measured in #4179 on playhorizon: teleport floods are kicked at once, chunk-ack floods are clamped, and moves into unloaded chunks are refused. The one real hole was the unbounded per-player inbox: 10 000 packets a tick grew the server by about 1 GB a minute. #4185 caps it (RSS 1937–1960 → 963–1039 MB under that flood; the flooder is kicked 2 s after joining). #4181 adds the abusive behaviours to horizon-bots. Next: costlier packet types (use-item, clicks, suggestions).
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: abusive-client step 3 (costly packets) is done: #4179 has the table. Two more holes, each with an A/B: command suggestions (one client took the server to 16–18 TPS; #4200 ports vanilla's one-a-tick provider), and large packets (390 books a tick reached 1.7 GB; #4185 now caps the inbox in bytes as well). Item use, clicks, recipes and signs: no effect, or already stopped by #4185. Back to W4 next.

<!-- gh-comment-id:6516133186 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: abusive-client step 3 (costly packets) is done: #4179 has the table. Two more holes, each with an A/B: command suggestions (one client took the server to 16–18 TPS; #4200 ports vanilla's one-a-tick provider), and large packets (390 books a tick reached 1.7 GB; #4185 now caps the inbox in bytes as well). Item use, clicks, recipes and signs: no effect, or already stopped by #4185. Back to W4 next.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4, faces kept by the load-time passes: #4232. analyse_shape and the support-table precompute no longer keep the six faces of every collision and support shape (~39 MB in the heap profile). Idle dedicated RSS on playhorizon, 3 interleaved rounds: main 341/340/342 MB → 302/302/305 MB (−38 MB). Startup unchanged (3.8–3.9 s). Next W4 candidates from the same profile: VanillaTerrain 26.6 MB, serde Content 21.6 MB, model quads 16.6 MB (render-only on a dedicated server), loot tables loaded twice (16 + 7.7 MB).

<!-- gh-comment-id:6517173647 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4, faces kept by the load-time passes: #4232. `analyse_shape` and the support-table precompute no longer keep the six faces of every collision and support shape (~39 MB in the heap profile). Idle dedicated RSS on playhorizon, 3 interleaved rounds: main 341/340/342 MB → 302/302/305 MB (−38 MB). Startup unchanged (3.8–3.9 s). Next W4 candidates from the same profile: VanillaTerrain 26.6 MB, serde `Content` 21.6 MB, model quads 16.6 MB (render-only on a dedicated server), loot tables loaded twice (16 + 7.7 MB).
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4, block models on a dedicated server: #4242. A dedicated server no longer binds and bakes the block models (only client drawing reads them). Idle RSS on playhorizon, 3 interleaved rounds: 341/341/341 → 321/319/322 MB (−20 MB). Ready: 3.73–3.79 → 3.50–3.60 s. Next: the second LootData copy (world open reloaded it beside worldgen's), A/B running.

<!-- gh-comment-id:6517334404 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4, block models on a dedicated server: #4242. A dedicated server no longer binds and bakes the block models (only client drawing reads them). Idle RSS on playhorizon, 3 interleaved rounds: 341/341/341 → 321/319/322 MB (−20 MB). Ready: 3.73–3.79 → 3.50–3.60 s. Next: the second LootData copy (world open reloaded it beside worldgen's), A/B running.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4, duplicate loot data: #4245. Opening a world reloaded the loot data beside the copy worldgen had loaded with the same (no) packs. Idle RSS on playhorizon, 3 interleaved rounds: 340/342/340 → 330/332/331 MB (−10 MB). W4 so far today: #4232 (−38), #4242 (−20), #4245 (−10).

<!-- gh-comment-id:6517423174 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4, duplicate loot data: #4245. Opening a world reloaded the loot data beside the copy worldgen had loaded with the same (no) packs. Idle RSS on playhorizon, 3 interleaved rounds: 340/342/340 → 330/332/331 MB (−10 MB). W4 so far today: #4232 (−38), #4242 (−20), #4245 (−10).
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4, render face visibility on a dedicated server: #4257. The dedicated server no longer builds the occlusion faces that only the mesher and the block-entity renderer read. Idle RSS on playhorizon, 3 interleaved rounds: 343/340/339 → 317/314/320 MB (−24 MB). With #4232 (−38), #4242 (−20) and #4245 (−10), that is ~−90 MB of idle from ~340 MB, if they add up (to be checked on main once they're merged). Serde Content (21.6 MB) is the block registry's own state strings, already a single copy; shrinking it needs interning BlockState (big refactor), not started.

<!-- gh-comment-id:6517698895 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4, render face visibility on a dedicated server: #4257. The dedicated server no longer builds the occlusion faces that only the mesher and the block-entity renderer read. Idle RSS on playhorizon, 3 interleaved rounds: 343/340/339 → 317/314/320 MB (−24 MB). With #4232 (−38), #4242 (−20) and #4245 (−10), that is ~−90 MB of idle from ~340 MB, if they add up (to be checked on main once they're merged). Serde `Content` (21.6 MB) is the block registry's own state strings, already a single copy; shrinking it needs interning `BlockState` (big refactor), not started.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4 list item 4 (item model library on a dedicated server): #4271, stacked on #4242. Idle RSS on playhorizon vs #4242's head, 3 interleaved rounds: 317/319/318 → 310/313/309 MB (−7 MB). The item components gameplay reads stay. Design for the next step (mmapped data file written by horizon-prepare): #4267.

<!-- gh-comment-id:6517999264 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4 list item 4 (item model library on a dedicated server): #4271, stacked on #4242. Idle RSS on playhorizon vs #4242's head, 3 interleaved rounds: 317/319/318 → 310/313/309 MB (−7 MB). The item components gameplay reads stay. Design for the next step (mmapped data file written by horizon-prepare): #4267.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: W4 list, items 5 and 6:

  • #4276: the dedicated server loads no block-entity renderer or AnimateTables. 338–341 → 331–334 MB (−6).
  • #4279: Items and LootData share one loot table map. 337–341 → 325–327 MB (−14: two of the three copies).

Measured and dropped:

  • Item 2: the worker 'scratch' is the structure template cache (~5 MB), which vanilla also keeps.
  • Item 9: building the sync data lazily would cost ~150 ms on the first join (commands+advancements 94 ms, recipes 42, registries 18), over the 50 ms budget; building it in the background after startup saves nothing at idle.
<!-- gh-comment-id:6518306108 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: W4 list, items 5 and 6: - #4276: the dedicated server loads no block-entity renderer or AnimateTables. 338–341 → 331–334 MB (−6). - #4279: `Items` and `LootData` share one loot table map. 337–341 → 325–327 MB (−14: two of the three copies). Measured and dropped: - Item 2: the worker 'scratch' is the structure template cache (~5 MB), which vanilla also keeps. - Item 9: building the sync data lazily would cost ~150 ms on the first join (commands+advancements 94 ms, recipes 42, registries 18), over the 50 ms budget; building it in the background after startup saves nothing at idle.
Author
Owner

@ludovic111 commented on GitHub (Oct 30, 2026):

🤖 Agent: #4320 fixes the recurring dedicated_server light-layers failure (#4294), which came from #4095's idle server keeping no spawn area: a column is now sent once its neighbours reach INITIALIZE_LIGHT, as in vanilla. Idle RSS unchanged (334/330/330 → 333/334/330 MB); with 30 idle bots joining, join p99 124/100/104 → 100/100/100 ms and first full view p50 3247/2746/2800 → 2603/2508/2701 ms on playhorizon.

<!-- gh-comment-id:6520191464 --> @ludovic111 commented on GitHub (Oct 30, 2026): 🤖 Agent: #4320 fixes the recurring `dedicated_server` light-layers failure (#4294), which came from #4095's idle server keeping no spawn area: a column is now sent once its neighbours reach INITIALIZE_LIGHT, as in vanilla. Idle RSS unchanged (334/330/330 → 333/334/330 MB); with 30 idle bots joining, join p99 124/100/104 → 100/100/100 ms and first full view p50 3247/2746/2800 → 2603/2508/2701 ms on playhorizon.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#1167
No description provided.