[PR #556] [MERGED] horizon-bots and tools/server_bench.py: the first server benchmark against vanilla #2643

Closed
opened 2026-11-02 15:57:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/556
Author: @ludovic111
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ludovic111

Base: main ← Head: feat/horizon-bots


📝 Commits (10+)

  • 9d21209 horizon-server: server.toml, init, and a supervisor that runs the game
  • e883219 horizon-server: start, stop, status, cmd and logs through a local control API
  • 3510764 horizon-server: backups, restore and automatic backups
  • ed6af00 horizon-server: install scripts, a Docker image, and boot services
  • 7f77772 horizon-server: the web panel
  • 820936b horizon-bots and tools/server_bench.py: the first server benchmark against vanilla
  • 07f7e3a Merge remote-tracking branch 'origin/main' into srv-fix
  • 2483f90 Merge feat/horizon-server into feat/horizon-server-control
  • 500241c Merge feat/horizon-server-control into feat/horizon-server-backups
  • 9497516 Merge feat/horizon-server-backups into feat/horizon-server-packaging

📊 Changes

39 files changed (+6005 additions, -17 deletions)

View changed files

📝 .github/workflows/release.yml (+5 -4)
📝 Cargo.lock (+35 -0)
📝 Cargo.toml (+1 -1)
➕ crates/horizon-bots/Cargo.toml (+14 -0)
➕ crates/horizon-bots/src/main.rs (+589 -0)
📝 crates/horizon-client/Cargo.toml (+2 -0)
📝 crates/horizon-client/src/game/dedicated.rs (+30 -0)
➕ crates/horizon-client/src/game/dedicated/status.rs (+100 -0)
📝 crates/horizon-client/src/lib.rs (+1 -1)
➕ crates/horizon-server-files/Cargo.toml (+16 -0)
📝 crates/horizon-server-files/src/eula.rs (+6 -1)
📝 crates/horizon-server-files/src/java_properties.rs (+0 -0)
📝 crates/horizon-server-files/src/json.rs (+0 -0)
📝 crates/horizon-server-files/src/lib.rs (+3 -3)
📝 crates/horizon-server-files/src/properties.rs (+0 -0)
📝 crates/horizon-server-files/src/user_lists.rs (+0 -0)
➕ crates/horizon-server/Cargo.toml (+29 -0)
➕ crates/horizon-server/panel/index.html (+78 -0)
➕ crates/horizon-server/panel/panel.css (+128 -0)
➕ crates/horizon-server/panel/panel.js (+270 -0)

...and 19 more files

📄 Description

PR 5 of docs/server.md (section 9), stacked on #555: bots and a first benchmark against vanilla.

What it does

  • crates/horizon-bots: a load client on horizon-protocol that works against any 26.3 server (vanilla, Paper, Horizon). One thread per bot.

    • It handles handshake, offline login and configuration (known packs, client information with the view distance), keep-alives and pings, teleports, chunk-batch acknowledgements, and movement plus ClientTickEnd at 20 Hz.
    • Bots play in creative and fly 24 blocks above their spawn point. They never touch terrain, so they need no copy of the world, and no server can refuse a move for walking into a block.
    • Behaviours are idle, walk (random points within 48 blocks, at sprint speed), explore (straight outwards at creative flying speed, which forces chunk generation) and mixed (60 % walk, 20 % explore, 20 % idle). They are deterministic from --seed.
    • It prints one JSON line a second and writes a report.
  • tools/server_bench.py: a fresh server per run, built from the same server.properties (seed 12345, view and simulation distance 10, offline, creative, force-gamemode). For each run it:

    1. waits for Done;
    2. lets the bots join one a second;
    3. warms up;
    4. measures MSPT (average/P50/P95/P99) from each server's own /tick query every 5 s, RSS and CPU of the whole process tree every second, and the chunks the bots receive per second.

    Vanilla runs the pinned jar from tools/lab.py prepare on Java 25 with -Xms4g -Xmx4g, and Horizon runs horizon-server run. Results go to a JSON report and a table.

First results

Mac mini M4 Pro (14 cores), seed 12345, view and simulation distance 10, mixed bots joining one a second, 60 s warm-up, 180 s measured; vanilla on Java 25 with -Xms4g -Xmx4g. The machine was shared with other sessions (CPU 79–93 % busy, load 64–85) for every run, so these numbers are noisy. They are a first look, not the published result.

Bots Server Start (s) MSPT avg P50 P95 P99 TPS RSS (GB) CPU (% of a core) Chunks/s to bots
1 Horizon 17.1 3.5 1.7 16.6 54.8 20.0 1.57 18 10
1 Vanilla 21.1 11.2 8.3 31.8 57.0 20.0 3.55 23 10
10 Horizon 19.7 98.1 58.1 339.1 514.9 10.2 2.13 204 132
10 Vanilla 26.1 46.9 30.5 142.6 213.6 20.0 3.61 64 59
25 Horizon 12.3 109.2 102.6 238.4 371.3 9.2 2.65 381 320
25 Vanilla 10.8 31.0 19.5 92.1 156.1 20.0 4.22 181 87
50 Horizon 6.8 65.0 44.0 191.9 272.2 15.4 3.69 442 323
50 Vanilla 32.2 65.0 31.1 212.6 383.7 15.4 4.57 149 77

TPS is derived from /tick query's average. Vanilla's RSS includes its pre-committed 4 GB heap.

What it shows:

  • Light load: Horizon ticks faster and uses less than half the RAM (3.5 ms against 11.2 ms MSPT, 1.6 GB against 3.6 GB with one bot).
  • 10 and 25 bots: Horizon falls behind, at about 10 TPS where vanilla keeps 20, and uses 2–3 times the CPU. It is also doing much more work. It sends the bots 2.2–3.7 times as many chunks per second as vanilla:
    • Vanilla pulls fast players back when it lags. It logged moved too quickly 17, 26 and 1,850 times at 10, 25 and 50 bots, rubber-banding the explore bots, so they generated less new terrain. Horizon has no such check (zero corrections at any load): a parity gap in movement validation worth an issue.
    • Vanilla's chunk sending yields under load. An idle bot gets 474 chunks from both servers at 10 bots. At 25 and 50 bots vanilla delivers 375 and 223, while Horizon still sends 473.
    • walk bots, which stay within 48 blocks of spawn, receive 2,867–3,075 chunks each from Horizon against 710–1,984 from vanilla. That is worth checking for chunks re-sent as a player moves near the edge of the view.
  • 50 bots: both servers land at about 15 TPS. Horizon still sends 4 times the chunks.

Next run: a quiet machine; explore at a speed vanilla accepts under load, so both servers generate the same terrain; a walk-only pass to compare ticking at equal chunk work; and 100 bots. These findings go to perf-server-1, which owns tick cost: this PR only measures.

Checks

  • cargo fmt --all --check: clean.
  • cargo clippy --workspace --all-targets -- -D warnings: clean on every branch of the stack.
  • Tests: cargo test -p horizon-server -p horizon-server-files pass on every branch (16 server tests in 2a, 24 at the tip). horizon-server also passes clippy and its tests on Linux (the ThinkPad).
  • Parity at the stack's tip (2a–3), rebased on b4ad6538:
    • tools/parity.py dedicated_server online_mode server_files server_player_combat server_player_damage: 5 passed, 0 failed. dedicated_server includes vanilla's protocol client joining Horizon's server.
    • The full --changed origin/main set (309 harnesses, because the client crate changes) had 60 passed, 0 failed when it was stopped. The Mac mini was running out of disk, and at about 1 harness a minute the run needed 4 more hours. CI's parity covers the rest.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/556 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/horizon-bots` --- ### 📝 Commits (10+) - [`9d21209`](https://github.com/horizon-rust/horizon/commit/9d21209ae8c4e6f788955abab69e7b96d1ef3237) horizon-server: server.toml, init, and a supervisor that runs the game - [`e883219`](https://github.com/horizon-rust/horizon/commit/e8832190d1017de6d23eb66c0b8dc75ca35cc95f) horizon-server: start, stop, status, cmd and logs through a local control API - [`3510764`](https://github.com/horizon-rust/horizon/commit/3510764cc645989ca3cd993310cbcaa1787e7e94) horizon-server: backups, restore and automatic backups - [`ed6af00`](https://github.com/horizon-rust/horizon/commit/ed6af00ff8c5482bbd7fe6f53dfeade354f1b651) horizon-server: install scripts, a Docker image, and boot services - [`7f77772`](https://github.com/horizon-rust/horizon/commit/7f77772e152b86edf82cd7ba72dd54d062bdbf17) horizon-server: the web panel - [`820936b`](https://github.com/horizon-rust/horizon/commit/820936b97541d221590e1f7baa6650b595abadef) horizon-bots and tools/server_bench.py: the first server benchmark against vanilla - [`07f7e3a`](https://github.com/horizon-rust/horizon/commit/07f7e3aeab80a1d3d3c76ef5b643eaaf1fa48fde) Merge remote-tracking branch 'origin/main' into srv-fix - [`2483f90`](https://github.com/horizon-rust/horizon/commit/2483f90779fa37882f4a3ceb3073fb9947e5e22b) Merge feat/horizon-server into feat/horizon-server-control - [`500241c`](https://github.com/horizon-rust/horizon/commit/500241cbc6563fdf0ff27cf4dbd36e57fccd9f71) Merge feat/horizon-server-control into feat/horizon-server-backups - [`9497516`](https://github.com/horizon-rust/horizon/commit/949751656a3cac04371b56fc3a1cd4b49796e9cf) Merge feat/horizon-server-backups into feat/horizon-server-packaging ### 📊 Changes **39 files changed** (+6005 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yml` (+5 -4) 📝 `Cargo.lock` (+35 -0) 📝 `Cargo.toml` (+1 -1) ➕ `crates/horizon-bots/Cargo.toml` (+14 -0) ➕ `crates/horizon-bots/src/main.rs` (+589 -0) 📝 `crates/horizon-client/Cargo.toml` (+2 -0) 📝 `crates/horizon-client/src/game/dedicated.rs` (+30 -0) ➕ `crates/horizon-client/src/game/dedicated/status.rs` (+100 -0) 📝 `crates/horizon-client/src/lib.rs` (+1 -1) ➕ `crates/horizon-server-files/Cargo.toml` (+16 -0) 📝 `crates/horizon-server-files/src/eula.rs` (+6 -1) 📝 `crates/horizon-server-files/src/java_properties.rs` (+0 -0) 📝 `crates/horizon-server-files/src/json.rs` (+0 -0) 📝 `crates/horizon-server-files/src/lib.rs` (+3 -3) 📝 `crates/horizon-server-files/src/properties.rs` (+0 -0) 📝 `crates/horizon-server-files/src/user_lists.rs` (+0 -0) ➕ `crates/horizon-server/Cargo.toml` (+29 -0) ➕ `crates/horizon-server/panel/index.html` (+78 -0) ➕ `crates/horizon-server/panel/panel.css` (+128 -0) ➕ `crates/horizon-server/panel/panel.js` (+270 -0) _...and 19 more files_ </details> ### 📄 Description PR 5 of [docs/server.md](https://github.com/ludovic111/horizon/pull/557) (section 9), stacked on #555: bots and a first benchmark against vanilla. ## What it does - **`crates/horizon-bots`**: a load client on `horizon-protocol` that works against any 26.3 server (vanilla, Paper, Horizon). One thread per bot. - It handles handshake, offline login and configuration (known packs, client information with the view distance), keep-alives and pings, teleports, chunk-batch acknowledgements, and movement plus `ClientTickEnd` at 20 Hz. - Bots play in creative and fly 24 blocks above their spawn point. They never touch terrain, so they need no copy of the world, and no server can refuse a move for walking into a block. - Behaviours are `idle`, `walk` (random points within 48 blocks, at sprint speed), `explore` (straight outwards at creative flying speed, which forces chunk generation) and `mixed` (60 % walk, 20 % explore, 20 % idle). They are deterministic from `--seed`. - It prints one JSON line a second and writes a report. - **`tools/server_bench.py`**: a fresh server per run, built from the same `server.properties` (seed 12345, view and simulation distance 10, offline, creative, `force-gamemode`). For each run it: 1. waits for `Done`; 2. lets the bots join one a second; 3. warms up; 4. measures MSPT (average/P50/P95/P99) from each server's own `/tick query` every 5 s, RSS and CPU of the whole process tree every second, and the chunks the bots receive per second. Vanilla runs the pinned jar from `tools/lab.py prepare` on Java 25 with `-Xms4g -Xmx4g`, and Horizon runs `horizon-server run`. Results go to a JSON report and a table. ## First results Mac mini M4 Pro (14 cores), seed 12345, view and simulation distance 10, `mixed` bots joining one a second, 60 s warm-up, 180 s measured; vanilla on Java 25 with `-Xms4g -Xmx4g`. **The machine was shared with other sessions (CPU 79–93 % busy, load 64–85) for every run, so these numbers are noisy. They are a first look, not the published result.** | Bots | Server | Start (s) | MSPT avg | P50 | P95 | P99 | TPS | RSS (GB) | CPU (% of a core) | Chunks/s to bots | |---:|---|---:|---:|---:|---:|---:|---:|---:|---:|---:| | 1 | Horizon | 17.1 | 3.5 | 1.7 | 16.6 | 54.8 | 20.0 | 1.57 | 18 | 10 | | 1 | Vanilla | 21.1 | 11.2 | 8.3 | 31.8 | 57.0 | 20.0 | 3.55 | 23 | 10 | | 10 | Horizon | 19.7 | 98.1 | 58.1 | 339.1 | 514.9 | 10.2 | 2.13 | 204 | 132 | | 10 | Vanilla | 26.1 | 46.9 | 30.5 | 142.6 | 213.6 | 20.0 | 3.61 | 64 | 59 | | 25 | Horizon | 12.3 | 109.2 | 102.6 | 238.4 | 371.3 | 9.2 | 2.65 | 381 | 320 | | 25 | Vanilla | 10.8 | 31.0 | 19.5 | 92.1 | 156.1 | 20.0 | 4.22 | 181 | 87 | | 50 | Horizon | 6.8 | 65.0 | 44.0 | 191.9 | 272.2 | 15.4 | 3.69 | 442 | 323 | | 50 | Vanilla | 32.2 | 65.0 | 31.1 | 212.6 | 383.7 | 15.4 | 4.57 | 149 | 77 | TPS is derived from `/tick query`'s average. Vanilla's RSS includes its pre-committed 4 GB heap. What it shows: - **Light load:** Horizon ticks faster and uses less than half the RAM (3.5 ms against 11.2 ms MSPT, 1.6 GB against 3.6 GB with one bot). - **10 and 25 bots:** Horizon falls behind, at about 10 TPS where vanilla keeps 20, and uses 2–3 times the CPU. It is also doing much more work. It sends the bots 2.2–3.7 times as many chunks per second as vanilla: - **Vanilla pulls fast players back when it lags.** It logged `moved too quickly` 17, 26 and 1,850 times at 10, 25 and 50 bots, rubber-banding the `explore` bots, so they generated less new terrain. **Horizon has no such check** (zero corrections at any load): a parity gap in movement validation worth an issue. - **Vanilla's chunk sending yields under load.** An idle bot gets 474 chunks from both servers at 10 bots. At 25 and 50 bots vanilla delivers 375 and 223, while Horizon still sends 473. - **`walk` bots, which stay within 48 blocks of spawn, receive 2,867–3,075 chunks each from Horizon** against 710–1,984 from vanilla. That is worth checking for chunks re-sent as a player moves near the edge of the view. - **50 bots:** both servers land at about 15 TPS. Horizon still sends 4 times the chunks. Next run: a quiet machine; `explore` at a speed vanilla accepts under load, so both servers generate the same terrain; a `walk`-only pass to compare ticking at equal chunk work; and 100 bots. These findings go to perf-server-1, which owns tick cost: this PR only measures. ## Checks - `cargo fmt --all --check`: clean. - `cargo clippy --workspace --all-targets -- -D warnings`: clean on every branch of the stack. - Tests: `cargo test -p horizon-server -p horizon-server-files` pass on every branch (16 server tests in 2a, 24 at the tip). horizon-server also passes clippy and its tests on Linux (the ThinkPad). - Parity at the stack's tip (2a–3), rebased on b4ad6538: - `tools/parity.py dedicated_server online_mode server_files server_player_combat server_player_damage`: **5 passed, 0 failed**. `dedicated_server` includes vanilla's protocol client joining Horizon's server. - The full `--changed origin/main` set (309 harnesses, because the client crate changes) had **60 passed, 0 failed** when it was stopped. The Mac mini was running out of disk, and at about 1 harness a minute the run needed 4 more hours. CI's parity covers the rest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:57:53 +07:00
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#2643
No description provided.