Foundation / checks (deploy) (push) Successful in 3m16s
Foundation / checks (ecs) (push) Successful in 1m54s
Foundation / checks (client) (push) Successful in 12m39s
Foundation / checks (network) (push) Successful in 12m56s
Foundation / checks (tsan) (push) Successful in 7m52s
Foundation / checks (checks) (push) Successful in 32m28s
Foundation / checks (postgres) (push) Failing after 26m52s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
ADR-0097. evo-load runs bots on worker threads, each a RegionSessionClient with its own account and an in-process dev grant: one intention per tick at its input lead with marker prediction, actions every 2 s, interest moves every 10 s, and re-login after any close. Stepped ramps report pooled and per-client distributions (response, receipt, outcome, login, prediction error), snapshot rate, gaps and bandwidth, drops, failed logins and refusals, generator CPU, a starvation check among connected bots, a budget verdict and the region's evo_m10_* gauges, ending with the sustainable bot count. A Postgres process smoke runs 4 then 8 bots against a real evo-server. Fixes found while ramping: the process fixture's short pumps never read (a chatty child blocked on its stdout pipe), and the load governor refused on a single tick of debt (now 2 refuse, 4 shed). Refreshes the dev session window. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
158 lines
8.7 KiB
Markdown
158 lines
8.7 KiB
Markdown
# ADR-0097: M10 load and abuse qualification and overload response
|
|
|
|
## Status
|
|
Accepted for M10.9 (2026-10-07). Decisions confirmed with the maintainer on 2026-10-07:
|
|
- **Venue.** Only measurements on the reference hardware count as qualification: one RKE2
|
|
worker per region host on evolution-dev (ADR-0089). Local runs are smoke tests and
|
|
development references, never evidence. The gate stays open until the dev run is done.
|
|
- **Load tool.** One multi-client tool, `evo-load`: N session clients in one process, each a
|
|
bot, reporting per-client distributions so aggregate throughput cannot hide a starved
|
|
client.
|
|
- **Overload response: refuse, then shed.** Measured per-tick work drives two thresholds.
|
|
Above the first, new logins are refused. Above the second, the interest and far-update
|
|
cadence of existing sessions shrink step by step. Both are restored with hysteresis, so
|
|
ticks do not fall behind for admitted sessions.
|
|
- **Abuse coverage:** packet fuzz, floods, slow peers and connect/disconnect storms, and
|
|
region lease loss with 20 or more sessions attached.
|
|
|
|
Delivery:
|
|
- **10.9a:** the work measurement, the load governor and its effects (this text).
|
|
- **10.9b:** `evo-load` and a local smoke test.
|
|
- **10.9c:** the abuse suite.
|
|
- **10.9d:** the evolution-dev run harness, then the reference results.
|
|
|
|
Each segment amends this ADR. Every threshold here is an engineering budget under
|
|
`schemas/network/m10-budgets-v1.md`, not a game rule.
|
|
|
|
## Context
|
|
ADR-0089 budgets:
|
|
- per-tick region work: p99 ≤ 25 ms on the reference worker;
|
|
- session handling: ≤ 0.5 ms per session per tick;
|
|
- at least 20 sessions per region (32 by default);
|
|
- overload response: shed interest and refuse new sessions before tick debt.
|
|
|
|
Until now nothing measured the work, and the only bound was the session count. A region
|
|
that falls behind accrues tick debt, which delays every admitted session's outcomes and
|
|
snapshots.
|
|
|
|
## Decision (10.9a)
|
|
- **Work measurement** (evo-server loop). Busy time is the host's step plus the session
|
|
bridge's work (session poll, replication, action carry and acknowledgements). Waits for
|
|
input and the loop's sleeps are excluded. When the simulated tick advances by k, the busy
|
|
time since the previous advance counts as k equal per-tick samples. The host's tick debt
|
|
is read with every sample.
|
|
- **Load governor** (`include/evo/server/load_governor.hpp`, portable, no clock). It keeps
|
|
a window of the last 40 samples (2 s). It reports the window's p95, p99 and maximum, plus
|
|
two outputs:
|
|
- **refusing** turns on when p95 ≥ 15 ms or tick debt ≥ 2;
|
|
- **shed level** (0-3) rises by one when p95 ≥ 20 ms or tick debt ≥ 4, at most once per
|
|
second.
|
|
|
|
One tick of debt is jitter (a commit flush or a scheduler hiccup) and only interrupts calm.
|
|
As first written, any debt refused logins for at least 5 s, which made a login just after
|
|
a restart's catch-up fail intermittently in a process test (amended in 10.9b).
|
|
|
|
Calm means p95 < 10 ms and no debt. After 5 s of calm the level drops by one. At level 0,
|
|
5 s more of calm turns refusing off. Any non-calm sample restarts the calm timer.
|
|
Thresholds are configurable and validated (`relax < refuse ≤ shed ≤ tick budget`).
|
|
- **Effects** (`RegionSessions::set_load`):
|
|
- While refusing, a Hello carrying a grant is closed with `capacity` before signature
|
|
work. Handoff tickets are still admitted: a crossing moves an existing player between
|
|
regions, and refusing it would strand the probe until the source aborts the transfer
|
|
(up to 40 s).
|
|
- The shed level limits replication (`ReplicationServer::set_shed`):
|
|
|
|
| Level | Radius cap | Near radius | Far updates |
|
|
|---|---|---|---|
|
|
| 0 | 7 | 3 | every 4 ticks |
|
|
| 1 | 7 | 3 | every 8 ticks |
|
|
| 2 | 5 | 3 | every 8 ticks |
|
|
| 3 | 3 | 2 | every 16 ticks |
|
|
|
|
The stored interest is kept, so shedding forces no fresh baseline. Entities beyond the
|
|
cap are removed from the client's view and return when the level drops. Each session's
|
|
own marker is still sent every tick it changes.
|
|
- **Exposition.** `/metrics` adds `evo_m10_*` gauges:
|
|
- sessions;
|
|
- refusing;
|
|
- shed level;
|
|
- work p95, p99 and maximum in microseconds;
|
|
- the session layer's share, p95 and p99 (the ADR-0089 per-session budget is checked
|
|
against it);
|
|
- refused logins (counter).
|
|
|
|
evo-server prints `m10 load refusing=R shed=L p95_us=P` on every change. No labels are
|
|
added.
|
|
|
|
## Consequences
|
|
- Under overload, honest new players are refused (`capacity`, retry later) and existing
|
|
sessions see a smaller, slower-updating view rather than delayed ticks. Crossings
|
|
continue.
|
|
- The thresholds are provisional until 10.9d measures the reference worker. A change is
|
|
made by amending this ADR and the budgets table.
|
|
- No change to the session protocol: the client already handles `capacity` and removals.
|
|
|
|
## 10.9a evidence (2026-10-07)
|
|
- Unit tests:
|
|
- the governor's thresholds, one step per second, hysteresis, the calm timer restarting
|
|
on a non-calm window, tick debt alone, and policy validation;
|
|
- the metrics families, present only with the listener and bounded at worst-case values;
|
|
- replication shedding: radius caps 5 and 3 without a fresh baseline or a change of the
|
|
stored interest, a far update every 16 ticks at level 3, and the full square back at
|
|
level 0;
|
|
- sessions under load: grant logins refused with `capacity` before signature work (the
|
|
grant stays usable), tickets admitted.
|
|
- Process test (`region_m10_session_tests.cpp`): a real evo-server with `--ops-listen`
|
|
exposes the `evo_m10_*` gauges.
|
|
|
|
Local development reference (WSL, Release, one session; not evidence): work p95 about
|
|
7 ms and p99 about 9 ms per tick. Of that, the session layer's p99 was about 4.5 ms. That
|
|
is far above 0.5 ms per session, so 10.9b examines it with evo-load. Likely contributors
|
|
are the per-tick snapshot source query and synchronous control renewals.
|
|
|
|
## 10.9b load tool (2026-10-07)
|
|
- **`evo-load`** (`tools/network/load.cpp`, quic preset; usage in its header). Bots run on
|
|
worker threads, each a `RegionSessionClient` with its own account and a dev grant signed
|
|
in-process. A bot:
|
|
- sends one intention per server tick at its `InputLead` (a random walk turning every
|
|
2 s) and predicts its marker with `MotionPredictor`;
|
|
- sends a probe action every 2 s and moves its interest every 10 s (a fresh baseline);
|
|
- logs in again 2 s after any close.
|
|
|
|
Steps raise the bot count (`--ramp-ms` apart), warm up, then hold. Each step reports:
|
|
- pooled p50, p95, p99 and maximum, plus the per-client p95 spread, for responsiveness
|
|
(input to the first own-marker snapshot applying it), receipt RTT, final-outcome
|
|
latency, login time and prediction error;
|
|
- snapshot rate, gaps and bandwidth per client;
|
|
- drops, failed logins and refusals;
|
|
- the generator's own CPU;
|
|
- with `--metrics`, the region's `evo_m10_*` gauges.
|
|
|
|
Starvation is judged among the bots connected during the hold: a snapshot rate under
|
|
80 % of the median, or a response p95 over both twice the median and the budget. A
|
|
step's verdict is within budget only with every bot established, no refusals or drops,
|
|
no starvation, response p95 within budget (150 ms by default), outcome p95 ≤ 1.5 s,
|
|
server work p99 ≤ 25 ms, no shedding or refusing, and no tick debt. The run ends with
|
|
`load result sustainable=N saturated_at=M`.
|
|
- **Smoke** (Postgres `region_m10_session_tests`): 4 then 8 bots against a real evo-server
|
|
with `--metrics`. Every bot logs in once with no drops or refusals, both steps measure
|
|
responses, outcomes and snapshots, and the report is complete.
|
|
- **Found while ramping:**
|
|
- The process-test fixture's `Child::pump(1ms)` rounded its wait down to 0 ms and never
|
|
read. A chatty evo-server then blocked on its full stdout pipe, which looked like a
|
|
server stall at 32 bots. The wait is now rounded up.
|
|
- The governor's any-debt refusal was too twitchy (see the amended decision above).
|
|
- **Local development reference** (WSL, Release, one region; not evidence):
|
|
|
|
| Bots | Verdict | Work p95 / max | Session p95 (per session) | Response p95 | Outcome p95 | Snapshots |
|
|
|---|---|---|---|---|---|---|
|
|
| 8 | within | 9.0 / 9.6 ms | 1.7 ms (0.22) | 106 ms | 659 ms | 20 Hz, no gaps |
|
|
| 16 | within | 11.0 / 11.2 ms | 3.5 ms (0.22) | 102 ms | 661 ms | 20 Hz |
|
|
| 24 | within | 13.1 / 13.3 ms | 5.8 ms (0.24) | 103 ms | 664 ms | 20 Hz |
|
|
| 32 | refusing | 14.3 / 17.0 ms | 8.4 ms (0.26) | 103 ms | 665 ms | 20 Hz |
|
|
|
|
At 48 and 64 bots, the bots beyond the 32-session cap fail at the transport connection
|
|
limit, and the 32 established sessions are unaffected. Prediction errors were 0 (no
|
|
loss on loopback), and no client starved at any step. The host step dominates the work;
|
|
the session layer stays near 0.25 ms per session (budget 0.5).
|