Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

multi: Use an APBF for per peer known addrs. #2583

Merged
merged 1 commit into from
Feb 8, 2021

Conversation

davecgh
Copy link
Member

@davecgh davecgh commented Feb 1, 2021

This requires #2579 and is rebased on #2580.

This modifies the server to track the per peer known addresses using a much more efficient APBF instead of an LRU cache which has significant overhead in addition to having to store the entirety of all items added to it.

False positives are acceptable as the goal is to avoid sending duplicate addresses which is an ideal case for APBFs.

More concretely, the current LRU cache that stores the known addresses can grow to around 1.69 MiB per peer when full while the new APBF only takes around 40 KiB, a reduction of around 97.7%, while exhibiting roughly the same computational performance.

Since there is a maximum of 125 peers by default, that means the current LRU cache can potentially grow to around ~211 MiB if fully populated for max peers. The new APBF, on the other hand, will only consume ~4.88 MiB under the same scenario.

@davecgh davecgh added this to the 1.7.0 milestone Feb 1, 2021
server.go Show resolved Hide resolved
This modifies the server to track the per peer known addresses using a
much more efficient APBF instead of an LRU cache which has significant
overhead in addition to having to store the entirety of all items added
to it.

False positives are acceptable as the goal is to avoid sending duplicate
addresses which is an ideal case for APBFs.

More concretely, the current LRU cache that stores the known addresses
can grow to around 1.69 MiB *per peer* when full while the new APBF only
takes around 40 KiB, a reduction of around 97.7%, while exhibiting
roughly the same computational performance.

Since there is a maximum of 125 peers by default, that means the current
LRU cache can potentially grow to around ~211 MiB if fully populated for
max peers.  The new APBF, on the other hand, will only consume ~4.88 MiB
under the same scenario.
@davecgh davecgh merged commit 1512058 into decred:master Feb 8, 2021
@davecgh davecgh deleted the multi_known_addrs_abpf branch February 8, 2021 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants