fix: evict the busiest component from the transition window, not the oldest entry - #33
Merged
Merged
Conversation
thedancingdeveloper
force-pushed
the
fix/transition-ring-share
branch
from
August 19, 2026 02:56
8178b8a to
3ee6d2d
Compare
…oldest entry The 200-entry snapshot window is shared by every component and evicted oldest-first, so the checks that change most often decide how far back it reaches for everyone. On a gateway at 18h uptime it went back barely two hours: port_forward.verification 88 44% dns.upstream_udp 78 39% external_probe 30 15% topology.route_intent 2 1% topology.client_lifecycle 2 1% Three high-frequency checks held 98% of it. The two describing what the gateway did to client routing — what an operator goes looking for when a container has lost egress — held two slots each and were minutes from being pushed out, with nothing in the response to say they had been. Evict the oldest entry of whichever component holds the most of the window instead, so a chatty component churns against itself and a quiet one keeps its place. Raising the capacity alone would only move the boundary; it does not stop one component owning the window. Nothing was ever lost durably: transitions are persisted and served from `/api/v2/history/events`. This is about what the at-a-glance view in `/api/v2/status`, which the dashboard renders, is worth on a busy gateway. Refs #29
thedancingdeveloper
force-pushed
the
fix/transition-ring-share
branch
from
August 19, 2026 03:55
3ee6d2d to
336f505
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #29.
What was wrong
CanonicalSnapshot.transitionsis a 200-entry ring (src/domain.rs) evictedoldest-first. It is shared across every component with no per-component share,
so whichever checks change most often decide how far back the whole window
reaches. Live snapshot from a gateway at 18h uptime — full, and reaching back
2.02 hours:
Three high-frequency checks held 98% of it. The two describing what the gateway
actually did to client routing — exactly what an operator goes looking for when
a container has lost egress — held two slots each and were minutes from being
pushed out, with nothing in the response to say they had been dropped.
What changed
Eviction now removes the oldest entry of whichever component holds the most of
the window, so a chatty component churns against itself and a quiet one keeps
its place. Ties go to whichever has been in the window longest, so it is
deterministic.
Raising
TRANSITION_CAPACITYinstead would only move the boundary — it does notstop one component owning the window.
Scope, honestly stated
Nothing was ever lost durably. Transitions are persisted and served from
/api/v2/history/events, which still returns rows from well outside thiswindow. This is about what the at-a-glance view is worth:
/api/v2/statusiswhat the dashboard renders and what an operator reads first.
This is also not fallout from #22 —
port_forward.verificationis the largercontributor at 44%. #22 raised the DNS share to 39% by making its episodes real
rather than sub-second, which is what made an existing limit visible. #28
reduces the DNS share further, and this change stops any single component owning
the window regardless.
Operational impact
The status snapshot reaches further back for low-frequency components. No API or
schema change — same field, same shape, same capacity. Behaviour with a single
active component is unchanged (still oldest-first), which is covered by a test.
Rollback: revert the commit.
Validation
cargo fmt --all --check,cargo clippy --all-targets -- -D warnings,cargo test --all-targets— clean, 208 tests. Four new tests: a chattycomponent not evicting a quiet one, capacity still respected, a single component
still evicting oldest-first, and two components at very different rates
converging on a share rather than the faster one owning the window.