p2p: peer exchange to find a region without the DHT, region-tagged peer cache, faster anti-entropy
A node with too few peers in a followed region asks its connected peers who they know there (sync kind "peers"); a peer answers even from another region, since gossip tells it which topics its connections subscribe to. Peers of the region are dialed, others only while the region has none. The peer cache records the regions a peer was seen in and a restart redials those first. Anti-entropy now runs every 10 minutes (plus or minus a fifth) with 3 peers per round instead of every 30 with one. Simulator: a newcomer whose remembered peers were all in another region got 0 of 114 listings with the seeds down, now 56 of 56; repair median at the same interval 25.9 s to 5.7 s. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
@@ -162,12 +162,13 @@ starting a design-heavy item; see "Working with the owner".
|
||||
real source addresses (`externalTrafficPolicy: Local`; the nodeport overlay
|
||||
uses `Cluster` and hides them), and the API limit needs `TRUSTED_PROXY` to
|
||||
cover the ingress or the whole site shares one allowance.
|
||||
- **Joining without the seeds.** A newcomer whose remembered peers are all in
|
||||
another region cannot find its region when no DHT server is up (sim: 0 of
|
||||
114 listings). Remember region peers separately, or ask connected peers.
|
||||
- **Faster repair.** Anti-entropy at 30 min takes hours to spread one missed
|
||||
listing (median ~2 h by the sim); consider a shorter interval or syncing
|
||||
with several peers per round.
|
||||
- **Joining without the seeds**: peer exchange and region-tagged peer cache are
|
||||
built (`internal/p2p/peerexchange.go`), tested with real nodes, and in the
|
||||
sim's "all seeds shut down" scenario a newcomer whose remembered peers are
|
||||
all in another region now gets everything (56 of 56; it was 0 of 114). Still
|
||||
open: a node that remembers no live peer at all needs a seed or the DNS name.
|
||||
- **Repair** is now every 10 min with 3 peers per round (median ~11 min by the
|
||||
sim; was ~2 h). Not measured on a real network.
|
||||
- **Message-sender abuse** (reports cover listings only).
|
||||
|
||||
**Decisions and non-code work (the owner's)**
|
||||
|
||||
Reference in New Issue
Block a user