Go-libp2p v0.29.0 released

:flashlight: Highlights

Smart Dialing

In our last release, we shipped Smart Dialing. To reiterate, it’s a clever way to reduce the number of spurious dials. Instead of dialing all addresses in parallel (which is what we did before v0.28), we now carefully rank the addresses and dial them one by one.

However, there were two areas where the logic we introduced could lead to suboptimal results:

  • There are some networks that block UDP. This means that we won’t be able to dial any QUIC or WebTransport connections at all. This is problematic since our smart dialing logic dials a QUIC address first before dialing a TCP address, which would lead to a regression for these users.
  • Similarly, not all ISPs support IPv6 yet. This is problematic as well, since we prefer IPv6 addresses over IPv4.

This is why smart dialing was disabled by default in v0.28.

For this release, we implemented a logic we call Black Hole Detection in this release. We now detect if UDP or IPv6 is completely blocked (blackholed) by observing the outcomes of dial attempts. When a black hole is detected, we skip QUIC / WebTransport and IPv6 addresses, respectively. This significantly reduces the number of unsuccessful dials for users in these environments. To monitor the status of black hole detection, we added two Grafana dashboards to our swarm dashboard, showing the percentage successful / failed dials on UDP and IPv6, and if that leads to our blackhole logic kicking in.

This now allows us to use RFC8305 Happy Eyballs for QUIC: When we dial a peer that has a QUIC IPv6 and IPv4 address, we dial the IPv6 address first, and only start dialing the IPv4 address if we haven’t heard back from the peer within 250ms. Only if we don’t hear back within another 250ms, we start dialing on TCP.

In a future release, we will enable a similar logic for TCP IPv6 and IPv4 addresses, however, this will require us to refactor our code a bit (see #2394 for details).

Preliminary measurements on the IPFS network show that:

  • In ~90% of the cases, we end up with a connection on the first address we dial.
  • Canceled connection attempts are reduced by more than 60% (compared to the v0.27 release).

Smart Dialing is now enabled by default. We don’t expect it to cause any performance regression, but if you find any problems, please open an issue. It can be disabled via a constructor option to libp2p.New:

libp2p.SwarmOpts(swarm.WithDialRanker(swarm.NoDelayDialRanker))

Metrics

Changelog

Contributors

Contributor Commits Lines ± Files Changed
Sukun 14 +1594/-711 48
Marco Munizaga 9 +1085/-541 48
Marten Seemann 14 +428/-205 44
Jorropo 4 +178/-51 8
Adrian Sutton 1 +190/-17 4
VM 2 +80/-79 49
Sahib Yar 1 +43/-4 5
Hlib Kanunnikov 2 +17/-14 5
libp2p-mgmt-read-write[bot] 1 +26/-0 1
GitHub 2 +6/-19 2
Prithvi Shahi 1 +3/-3 1
Bryan White 1 +2/-2 1
1 Like