Skip to content

AddressStore: Improve the efficiency of the address store #408

@lexnv

Description

@lexnv

The address store is used in two places for keeping track of healthy addresses:

  • Transport manager (the source of truth for dialing)
  • Kademlia address store (eventually consistent store, for responding efficiently on FIND_NODE queries)

/// Known addresses of peer.
pub(super) address_store: AddressStore,

The address store sorts the containing addresses of the peer every time it wants to respond to FIND_NODE queries:

/// Returns the addresses of the peer.
pub fn addresses(&self) -> Vec<Multiaddr> {
self.address_store.addresses(MAX_ADDRESSES)
}

This leads to ~5-7% worse CPU performance. Instead, investigate if we can live with an address store which contains 3 buckets: successfully dialed, undialed, and failure to dial. This should improve the performance as we'll not have to do any sorting.

Another possible revenue source to follow: we could return an iterator over references of addresses (and possibly avoid 1 extra allocation).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions