HomePhabricator

Replace mruset setAddrKnown with CRollingBloomFilter addrKnown
d81cff32e50fUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Replace mruset setAddrKnown with CRollingBloomFilter addrKnown

Use a probabilistic bloom filter to keep track of which addresses
we think we have given our peers, instead of a list.

This uses much less memory, at the cost of sometimes failing to
relay an address to a peer-- worst case if the bloom filter happens
to be as full as it gets, 1-in-1,000.

Measured memory usage of a full mruset setAddrKnown: 650Kbytes
Constant memory usage of CRollingBloomFilter addrKnown: 37Kbytes.

This will also help heap fragmentation, because the 37K of storage
is allocated when a CNode is created (when a connection to a peer
is established) and then there is no per-item-remembered memory
allocation.

I plan on testing by restarting a full node with an empty peers.dat,
running a while with -debug=addrman and -debug=net, and making sure
that the 'addr' message traffic out is reasonable.
(suggestions for better tests welcome)

Details

Provenance
Gavin Andresen <gavinandresen@gmail.com>Authored on Apr 25 2015, 20:25
Pieter Wuille <pieter.wuille@gmail.com>Committed on Apr 30 2015, 15:16
schancelPushed on Jan 5 2018, 21:58
schancelPushed on Jan 5 2018, 21:39
schancelPushed on Jan 5 2018, 21:17
Parents
rSTAGING69a5f8be0abd: Rolling bloom filter class
Branches
Unknown
Tags
Unknown

Event Timeline

Pieter Wuille <pieter.wuille@gmail.com> committed rSTAGINGd81cff32e50f: Replace mruset setAddrKnown with CRollingBloomFilter addrKnown (authored by Gavin Andresen <gavinandresen@gmail.com>).Apr 30 2015, 15:16