js-libp2p icon indicating copy to clipboard operation
js-libp2p copied to clipboard

AddressBook with multiaddr confidence

Open vasco-santos opened this issue 5 years ago • 0 comments

As part of the PeerStore improvements epic, we intend to add multiaddr confidence into the AddressBook.

Background

When js-libp2p dials a peer, it tries to dial several known addresses of a peer in parallel. We use a token based dialer to not use a lot of resources to a single connection. However, we don't have a good way of deciding which subset of addresses we should try first. If we gather metrics from peer addresses stored in the PeerStore, we can create a scoring function for the addresses.

Goals

  • Know when multiaddrs are successful and when they fail so we can keep track of their confidence (take aborted dials into account)
  • Understand the confidence in each multiaddr of a peer so we can manage addresses we store/use/exchange

WIP Notes

  • If we dial multiple addrs, and we abort the slower addrs, take into account the confidence of the fastest address
    • Update on success, update on failure, aborts are no ops
    • When the Abort is a timeout abort, treat as a failure for all addresses that were tried
      • Need to account for low dial timeouts poisoning potentially valid address confidence
        • Potentialy weight low dial timeout confidence adjustments
  • Parameters: latency, availability, last connection timestamp
  • Score function

Relevant Issues

vasco-santos avatar Mar 25 '20 08:03 vasco-santos