fix: decrease default routing table size#3023
Merged
achingbrain merged 2 commits intomainfrom Mar 3, 2025
Merged
Conversation
Reduces the default routing table size to 1280. This improves CPU/memory/network usage as we don't need to sort as many peers when finding the closest ones to a given key, nor do we need to contact as many to ensure only live peers are still in the table.
2color
reviewed
Mar 3, 2025
Contributor
|
How does this compare to the defaults in https://github.com/libp2p/go-libp2p-kad-dht? |
Member
Author
go-libp2p-kad-dht uses a different data structure for it's routing table, something more similar to #2747 so a direct comparison is difficult. Instead js-libp2p has a binary trie with peers equally distributed across the address space - the idea is this results in faster lookups for arbitrary data since we know of more peers further from our own peer id. To ensure we stay well connected it also maintains a separate list of the 20 peers closest to the node's peer ID so far encountered. |
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.
Reduces the default routing table size to 1280 (down from 5120).
This improves CPU/memory/network usage as we don't need to sort as many peers when finding the closest ones to a given key, nor do we need to contact as many to ensure only live peers are still in the table.
Change checklist