Skip to content

Ariadne conference: a stale tick is no clock reading; the relay re-stamps a still avatar every 5 s - #999

Merged
transfix merged 2 commits into
masterfrom
perf/conference-quiet-pose-tick
Nov 3, 2026
Merged

transfix merged 2 commits into
masterfrom
perf/conference-quiet-pose-tick

Conversation

@transfix

@transfix transfix commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Why

After #995 quieted the traffic meters, the room tree's pose.server_tick was most of an
idle client's downlink:

  • The tree's copy of a still avatar's pose was re-stamped every second.
  • Every receiver got every still peer's tick once a second, and the WebSocket re-broadcast sent it again.

The pose stream already carries the 1 s heartbeat that clients' clocks follow. But the tree's heartbeat
couldn't be stretched, because a client took every sample's tick as a clock reading:

  • A still peer's pose in the tree is stamped at its last heartbeat.
  • A joiner that had applied a current stream sample would then seek its clock back to the stale tick,
    and forward again at the next sample.
  • Each seek drops the local avatar's logged inputs.

At 1 s this already happened (a late joiner re-aligned up to 4 times). A longer tree heartbeat made it
worse, which is why #995 left the heartbeat alone.

What changes

  • holon::apply_authoritative:
    • Only a sample at least as new as the newest one applied, from any participant, is a clock reading.
      The slew/seek moved into holon::read_clock.
    • An older sample still updates its participant: it places a peer, or reconciles our own avatar.
    • A sample more than holon_config::stale_reading_ticks older (1200 ticks, 10 s, the same window as
      client_pump's leftover rule) is a restarted relay, whose ticks start again near zero. That one is
      still a reading.
  • server_pump: takes the tree pose heartbeat (pose_heartbeat_s, default 1 s, unchanged for
    clients that read poses only from the tree). arisrv passes 5 s, under client_pump's 10 s leftover
    window. arisrv_aoi_bench mirrors it.
  • arisrv_aoi_bench: the late joiner now runs frames like a real client while it joins, plus 3 s
    after converging. The report gives its clock's re-alignments, which is how the numbers below were
    measured.

HolonTest.RealignCounterCountsSeeks asserted the old behavior: "a peer whose tick a heartbeat left old
... seeks the clock back". It now checks a counted seek from a stalled replica instead.

Measured

arisrv_aoi_bench --clients 4 --layout spawn --move off --media off --transport ws --poses stream --seconds 15, five runs each, on Windows (static Release). Four still clients and a late joiner.
"Before" is #995's tip; "after" is #995 plus this change.

late joiner's clock re-aligns state into each still receiver
before 4, 1, 2, 4, 4 10.4–11.9 kb/s
after 1, 1, 1, 2, 2 5.8–7.0 kb/s

When a second re-align remains, the joiner's first sample came from the tree, still stale, before any
stream sample. The next current sample moves the clock forward once, with no back-and-forth.

One idle browser client, local relay, 60 s of the page's WebSocket frames (as in #995):

up down
#995 0.09 kb/s 1.4–1.8 kb/s (of which pose.server_tick 1.0–1.3)
#995 + this 0.19 kb/s 0.90 kb/s (pose.server_tick 0.33)

The up difference is one rtt_ms meter write in that window.

A browser client's own re-align count at join isn't a useful measure here. While the page loads, its
measured round trip runs from about 4 s down to 20 ms, and the lead follows it, so the clock re-aligns
at startup even alone in the room.

Tests

  • holon_test AStaleSampleIsNoClockReading:
    • a peer's sample 5 s older than the newest one places the peer and leaves the clock alone;
    • a restarted relay's far-older tick is a reading.
  • holon_sync_test AJoinerTakesNoClockReadingFromAStaleTreeTick: a joiner takes a still peer's stale
    tree pose without a second re-align. Disabling the gate in holon.cpp makes it fail with 3 re-aligns
    instead of 1, and AStaleSampleIsNoClockReading fail too.
  • holon_sync_test ThePoseHeartbeatPacesTheTreesRestamp: 10 re-stamps in 10 s at 1 s, 2 at 5 s, with
    no other pose leaf written.
  • On this branch's commit over master, these all pass on a Windows static Release build:
    • holon_test, holon_sync_test
    • room_intrinsics_test, room_avatar_test
    • room_aoi_test, room_aoi_relay_test
    • room_relay_integration_test
  • clang-format 18.1.8 is clean.

Notes

…amps a still avatar every 5 s

The room tree's copy of a still avatar's pose was re-stamped every second, so
each receiver got every still peer's pose.server_tick once a second, and the
WebSocket re-broadcast sent it again. The pose stream already carries the 1 s
heartbeat that clients' clocks follow, but the tree's could not be stretched:
a client took every sample's tick as a clock reading. A still peer's pose in
the tree is stamped at its last heartbeat, so a joiner that had applied a
current stream sample would seek its clock back to the stale tick and forward
again at the next one, dropping its avatar's logged inputs each time.

- holon::apply_authoritative: only a sample at least as new as the newest one
  applied, from any participant, is a clock reading (holon::read_clock). An
  older one still updates its participant. More than
  holon_config::stale_reading_ticks (1200, 10 s) older is a restarted relay,
  whose ticks start again near zero, and is a reading.
- server_pump takes the tree pose heartbeat (default 1 s). arisrv passes 5 s,
  under client_pump's 10 s leftover window; arisrv_aoi_bench follows.
- arisrv_aoi_bench: the late joiner frames as a client does while it joins,
  and the report gives its clock's re-alignments.

Tests: holon_test AStaleSampleIsNoClockReading (RealignCounterCountsSeeks now
seeks on a stalled replica instead of a stale peer); holon_sync_test
AJoinerTakesNoClockReadingFromAStaleTreeTick and
ThePoseHeartbeatPacesTheTreesRestamp.
…et-pose-tick

# Conflicts:
#	src/cvc/tests/holon_sync_test.cpp
@transfix
transfix merged commit edca954 into master Nov 3, 2026
16 of 27 checks passed
@transfix
transfix deleted the perf/conference-quiet-pose-tick branch November 3, 2026 20:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant