Skip to content

Commit 6513534

Browse files
mikhail-dclclaude
andcommitted
docs: correct the clustering pass cost figures
The ceiling figure quoted Pass + churn without subtracting Churn, which the benchmark's own guidance says to do. ~395 us cold, and the cold/warm definition now sits in its own paragraph. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent c32bbcd commit 6513534

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

docs/clustering-on-aoi.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ Cluster at cell granularity, reusing the AoI grids — no second grid:
4747

4848
No cap: a connected crowd is one cluster, deterministically.
4949

50-
**Limits.** Hard ceiling: instance capacity (`Transport.MaxPeers`, 4095 — fixed arrays, no cross-instance clustering), further confined per realm. The algorithm adds none: O(N + C), C = occupied cells. Measured **~494 µs/pass at the 4095 ceiling** — Genesis City-sized world, cold working set, `ClusterTrackerBenchmarks` scenario `CeilingUniform` (~321 µs warm; ~230 KB of gen0 per pass, almost all of it the immutable `ClusterPass` the readers hold). The documented scenarios cost far less: ~9 µs for the 100-peer sparse case, ~52–56 µs for the 1 000-peer ones.
50+
**Limits.** Hard ceiling: instance capacity (`Transport.MaxPeers`, 4095 — fixed arrays, no cross-instance clustering), further confined per realm. The algorithm adds none: O(N + C), C = occupied cells. Measured **~395 µs/pass at the 4095 ceiling** — Genesis City-sized world, cold working set, `ClusterTrackerBenchmarks` scenario `CeilingUniform` (~321 µs warm; ~230 KB of gen0 per pass, almost all of it the immutable `ClusterPass` the readers hold). The documented scenarios cost far less: ~8 µs for the 100-peer sparse case, ~31–35 µs for the 1 000-peer ones.
5151

52-
Splitting the grid per realm (§2) moved the ceiling figure down from ~590 µs cold / ~424 µs warm. The work it removed — partitioning each cell's occupants by realm, and interning the realm name — ran once per occupied cell, so the gain tracks cell count rather than peer count: `CeilingUniform` has 1 904 occupied cells and improved ~16% cold, while the 28–52-cell 1 000-peer scenarios are unchanged within noise. Allocation and the resulting partition are identical. That is 0.06% of one core at the 1 Hz cadence, so the pass is not a scaling concern below a capacity change; an earlier estimate of "well under 1 ms at 10k peers" was optimistic, since 10k is not reachable on one instance anyway. The practical bound is density and belongs to AoI: clusters don't affect fan-out, so spread clusters can reach instance capacity while dense crowds hit per-observer AoI fan-out (~n² within `MaxRadius`) first. Downstream, LiveKit room mapping shards past ~low thousands (§3.6).
52+
That is 0.04% of one core at the 1 Hz cadence, so the pass is not a scaling concern below a capacity change; an earlier estimate of "well under 1 ms at 10k peers" was optimistic, since 10k is not reachable on one instance anyway. The practical bound is density and belongs to AoI: clusters don't affect fan-out, so spread clusters can reach instance capacity while dense crowds hit per-observer AoI fan-out (~n² within `MaxRadius`) first. Downstream, LiveKit room mapping shards past ~low thousands (§3.6).
53+
54+
"Cold" throughout is `Pass + churn` minus `Churn only` — a difference of means, so its error is the sum of both rows'. Quote it rather than the warm figure: `Pass` repeats over an unchanging grid and keeps its working set in cache, which a second of production tick and packet traffic does not.
5355

5456
**Percolation limit — at capacity on a full-size realm, the partition collapses.** Cell-adjacency clustering is site percolation on the grid: once the occupied fraction passes the 8-neighbour (Moore) threshold of ≈ 0.407, the occupied cells form one giant connected component and every peer lands in one cluster. Genesis City (4800 u) at 100 u cells is 48 × 48 = 2304 cells, so `MaxPeers` 4095 spread uniformly gives λ ≈ 1.78 peers/cell and an occupied fraction of `1 − e^−λ`**0.83** — roughly twice the threshold. Measured (`ClusterTrackerBenchmarks`, `CeilingUniform`): 1904 occupied cells, **2 clusters, the larger holding 4091 of 4095 peers**.
5557

0 commit comments

Comments
 (0)