Repository navigation
feat(routing): opt-in persistence of the DHT routing table - #11481
guillaumemichel wants to merge 5 commits into
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
Note: CI fails for Interop / ipfs-webui but it is unrelated to this specific PR. See #11479 |
MeasurementsMeasured on the Amino DHT, 2026-10-21 to 2026-10-28. Full tables and method are in libp2p/go-libp2p-kad-dht#1299. Kubo restart comparisonKubo with its default connection manager, restarted 3 times with the flag on and 3 times with it off:
How long saved peers stay usefulRouting tables saved by nodes that had run for 30 minutes, re-dialed at increasing ages:
So a Kubo node that was down for a week still rejoins in under a second without the bootstrap peers. Longer-running nodes save more stable routing tablesA routing table keeps its peers until they stop answering, so the longer a node runs, the more its table holds stable, long-lived peers. A routing table saved by a node that had run for 24 hours, compared with the 30-minute ones:
The gap widens with time: the 30-minute snapshots shed their short-lived peers, while the 24-hour one had already settled on peers that stay online. |
Companion to libp2p/go-libp2p-kad-dht#1299, ipfs/boxo#1220 and ipfs/boxo#1223.
This adds an opt-in
Routing.PersistDHTRoutingTableflag. With it, Kubo remembers its Amino DHT routing table across restarts and rejoins the network through the peers it already knew, instead of through the bootstrap peers.Motivation
A running node knows hundreds of DHT servers. The longer it runs, the more of them are stable peers, likely to still be online after a restart. Today Kubo forgets them and starts every time from the same few bootstrap peers, then slowly works its way back to stable peers. The bootstrap peers carry load the rest of the network could easily absorb, a node can't rejoin when they are unreachable, and every restart trusts them for the node's first view of the network. Restoring the routing table skips that climb back, makes restarts faster, and makes the network less dependent on a few operators.
Kubo already saves backup bootstrap peers at
/local/temp_bootstrap_peers, but they serve a narrower purpose: up to 20 of the node's connected peers, not necessarily DHT servers, dialed only after the configured bootstrap peers fail.How it works
dht.BootstrapOrder(dht.PersistedFirst)), and the bootstrap peers only if fewer than 10 saved peers answer within 20 seconds.BootstrapConfig.DeferFirstRound, so the periodic bootstrapper first runs after onePeriod, as a backstop. DirectIpfsNode.Bootstrapcallers keep the blocking first round./local/temp_bootstrap_peerson startup.dht.RoutingTablePersistence(0), and the backup bootstrap peers are saved and used as before.Rollout
The plan is to ship this feature as opt-in in the next release, and if it behaves as expected to make it the default in an upcoming version.
TODO
go-libp2p-kad-dhtv0.43.0go-libp2p-kad-dhtv0.43.0boxo@master(after both boxo PRs are merged)Routing.PersistDHTRoutingTable=true(see feat(routing): opt-in persistence of the DHT routing table #11481 (comment))Routing.PersistDHTRoutingTable=false