statement-store: DHT PoC bound the peers topology with LRU eviction#12496
Open
DenzelPenzel wants to merge 1 commit into
Open
statement-store: DHT PoC bound the peers topology with LRU eviction#12496DenzelPenzel wants to merge 1 commit into
DenzelPenzel wants to merge 1 commit into
Conversation
5bd8148 to
4e8285a
Compare
alexggh
reviewed
Jun 29, 2026
| } | ||
|
|
||
| /// Cap on `discovered`; without it, routing-table updates and identifies grow it without bound. | ||
| const MAX_KNOWN_PEERS: usize = 4096; |
4e8285a to
ad062a1
Compare
ad062a1 to
df35caf
Compare
|
All GitHub workflows were cancelled due to failure one of the required jobs. |
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.
Description
Impl #12289
The v2 DHT peers topology kept every peer learned from routing-table updates and identifies, so
discoveredgrew without bound — theTODOthis PR removes.It now evicts on insert (no timer): when a new peer is learned,
evictdrops the least-recently-seen disconnected peer while that peer is eitherPEER_STALENESS_TTL(24h), ordiscoveredexceedsMAX_KNOWN_PEERS(8192).Staleness is the routine bound; the count cap is a flooding backstop. A single wall-clock
last_seen, refreshed by every event that observes a peer, drives both. Connected peers (those with an open notification substream) are never evictedAn evicted peer is also removed from
discovered_index, so it is no longer returned byclosest_known,is_dht_affine, orpeers_for_topics.