Repository navigation
Re-measure parked perf 2.3 (AOI-scoped broadcast events) before deciding to collapse the five tables into one #45
Description
Perf catalog 2.3's gateway half (AOI-scoping game_combat_event / game_spell_cast_event /
game_spell_impact_event / game_emote_event / game_roll_event instead of leaving them global
SELECT * per player) was measured as a net loss and parked on a private branch: 100 players
19.0% → 27.3% writer, because it adds five subscription queries per player (a box goes 4→9) and
at ~5 event-rows/s the fan-out saving didn't cover it. The schema half (spatial columns +
by_grid index on all five tables) is already on main (private-history commit); only the
gateway-side query scoping is parked.
Those numbers predate the raw-bytes motion relay and the removal of the per-player item
catalogue (~37MB/connection). Both changed the gateway's cost profile since the 19.0/27.3%
figures were recorded, so whether the trade still holds is unknown in either direction. Full
design context, including two problems found in the parked branch itself that must be fixed
before it can be benchmarked meaningfully, is in the broadcast-event-collapse design doc
(private working origin) — read it before starting:
- The parked branch's tip is stale in three unrelated ways (still carries the
game_item_templateper-player subscription the catalogue removal deleted; lacks the
raw-bytes motion relay; lacks theMOTIONSTATinstrumentation from old work-item 287,
private archive). It needs itsaoi_event_queries+base_queriesdiff re-applied on top of
currentmain, not a literal checkout of the old tip. - Independent of staleness, the parked branch's
AreaOfInterestTracker::update(recenter) drops
game_entity_motion/game_creature_spline/ all five event queries on every cell-boundary
crossing — a reintroduction of an old recenter bug's exact shape (old work-item 109, private
archive), which the branch's own deleted guard tests used to catch. This must be fixed
(restore a shared query-list helper covering the full box, events included) before any
benchmark against this branch is trustworthy — otherwise a run that lets sessions recenter
(any HOLD long enough for players to cross a cell at run speed, ~7s) will silently look
cheaper than the real design.
The design doc's recommendation, which this item exists to execute: run the re-measure BEFORE
committing to any further code. If the corrected branch's trade has already flipped favorable
(likely, given the motion-relay and item-catalogue changes), unpark it as-is — it already exists,
no new code needed beyond the two fixes above. If it still shows a net loss, the next lever is
collapsing the five tables into one with a kind discriminator (sized in the design doc §4: 10
writer-site edits across module/src/combat/mod.rs, module/src/chat.rs,
module/src/spell/cast.rs, module/src/spell/scheduler.rs; one new table replacing five; a
spacetime generate regen; AOI-off must keep a global fallback query for whichever shape wins,
or that mode silently stops relaying these five event kinds entirely, the same hole perf 2.1
left behind). Do NOT start the collapse's schema work before the re-measure number exists — it
may be solving a problem the motion-relay and item-catalogue changes already solved.
Use the co-located-crowd harness runbook (Runbook A, private working origin) as the general
shape, adapted to run against the corrected parked branch rather than main.
Done when: the corrected parked branch (staleness + recenter bug both fixed) has been
benchmarked against the same co-located-crowd shape that produced the 19.0/27.3% figures, the
result is recorded in the design doc or a dated bench report (private working origin), and a
decision is made and recorded: unpark as-is, unpark with the collapse, or leave parked — with the
number that drove the call.
2026-07-30: the writer argument for this item is REFUTED
A direct measurement (old work-item 295, private archive) trimmed the per-player subscription
list from 26 entries to 12 and then to 2, at 150 and 300 clients. The writer's subscribe cost
did not move: 2.18 s / 2.45 s / 2.42 s at 150, and an identical 0.035-0.036 % occupancy per
transaction at 300.
So collapsing six broadcast tables into one does not reduce writer cost by reducing query
count. The hypothesis that promoted this item is dead. What remains as genuine justification is
narrower and should be stated honestly if anyone picks it up:
- one subscription to re-subscribe per AOI recenter instead of six (this is a CHURN argument, and
churn is now the leading suspect for 2.3's original regression — see old work-item 295, private
archive); - one gateway binding and one relay dispatch instead of six;
- and it is a prerequisite for AOI-scoping those events at all, which is what 2.3 wanted.
It remains a schema-migration-shaped change touching 10 writer functions across 4 files. Do not
start it on the strength of the writer number, because there isn't one.
Related: the Phase C straddle-cost measurement shares this issue's churn axis. Whichever runs
first should record its recenter-rate numbers where the other can use them. That measurement does
not subsume this issue — the broadcast-event collapse is a separate decision.
Migrated 2026-08-11 from the private tracker (spacetime-core#178; originally work-item 293).
Activity
Mathih13 commentedon Sep 7, 2026
The proposed experiment targets the removed per-Character event subscriptions. PR #421 now installs stable per-Shard event subscriptions and selects audiences in WorldView, so the parked branch no longer tests the active design.
Evidence: #421 and https://github.com/LyraCoreProject/LyraCore/blob/b4c17c481f66784fd24677f583e0368fc3ac8c95/gateway/src/stdb/world_view.rs . Current crowd performance remains in #59 and #86. No new performance result is claimed.