Skip to content

statement-store: DHT PoC bound the peers topology with LRU eviction#12496

Open
DenzelPenzel wants to merge 1 commit into
feature/statement-store-dhtfrom
denzelpenzel/v2-dht-peers-eviction
Open

statement-store: DHT PoC bound the peers topology with LRU eviction#12496
DenzelPenzel wants to merge 1 commit into
feature/statement-store-dhtfrom
denzelpenzel/v2-dht-peers-eviction

Conversation

@DenzelPenzel

@DenzelPenzel DenzelPenzel commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Impl #12289

The v2 DHT peers topology kept every peer learned from routing-table updates and identifies, so discovered grew without bound — the TODO this PR removes.

It now evicts on insert (no timer): when a new peer is learned, evict drops the least-recently-seen disconnected peer while that peer is either

  • stale — unseen by any event for PEER_STALENESS_TTL (24h), or
  • over capacitydiscovered exceeds MAX_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 evicted

An evicted peer is also removed from discovered_index, so it is no longer returned by closest_known, is_dht_affine, or peers_for_topics.

@DenzelPenzel DenzelPenzel added T0-node This PR/Issue is related to the topic “node”. T10-tests This PR/Issue is related to tests. labels Jun 26, 2026
@DenzelPenzel DenzelPenzel requested a review from alexggh June 26, 2026 17:00
@DenzelPenzel DenzelPenzel force-pushed the denzelpenzel/v2-dht-peers-eviction branch 3 times, most recently from 5bd8148 to 4e8285a Compare June 26, 2026 17:16
}

/// Cap on `discovered`; without it, routing-table updates and identifies grow it without bound.
const MAX_KNOWN_PEERS: usize = 4096;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be higher.

@DenzelPenzel DenzelPenzel force-pushed the denzelpenzel/v2-dht-peers-eviction branch from 4e8285a to ad062a1 Compare June 29, 2026 14:54
@DenzelPenzel DenzelPenzel force-pushed the denzelpenzel/v2-dht-peers-eviction branch from ad062a1 to df35caf Compare June 29, 2026 15:12
@paritytech-workflow-stopper

Copy link
Copy Markdown

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/28382359644
Failed job name: test-linux-stable-int

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T0-node This PR/Issue is related to the topic “node”. T10-tests This PR/Issue is related to tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants