Files
aevolution/docs/adr/0097-m10-load-and-abuse-qualification.md
T
dingoandClaude Opus 5.5 b8cb9db297
Foundation / checks (deploy) (push) Successful in 3m20s
Foundation / checks (ecs) (push) Successful in 1m59s
Foundation / checks (client) (push) Failing after 10m0s
Foundation / checks (network) (push) Successful in 13m9s
Foundation / checks (tsan) (push) Successful in 8m1s
Foundation / checks (checks) (push) Successful in 32m2s
Foundation / checks (postgres) (push) Failing after 26m39s
Foundation / postgres-tools (push) Skipped
Foundation / server-image (push) Skipped
Foundation / image (push) Skipped
Add M10.9a load measurement, governor and overload shedding
ADR-0097 (M10.9 load and abuse qualification; only evolution-dev
reference-worker runs qualify). evo-server measures each simulated tick's
work (host step plus the M10 bridge, with the session layer's share kept
separately) and feeds a portable LoadGovernor: grant logins are refused
at a 2 s p95 of 15 ms or any tick debt, replication is shed in up to
three levels at 20 ms or debt >= 2 (radius cap 7/7/5/3, far updates
x1/x2/x2/x4, no fresh baselines, own markers unaffected), and both relax
after 5 s of calm. Handoff tickets are still admitted. /metrics gains
evo_m10_* gauges when the listener is enabled.

Adds the missing ADR index entries for ADR-0094 to ADR-0096. Refreshes
the dev session window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 06:34:40 -04:00

5.6 KiB

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 > 0;
    • shed level (0-3) rises by one when p95 ≥ 20 ms or tick debt ≥ 2, at most once per second.

    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.