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

add a test plan that measures the RTT of libp2p handshakes #52

Open
Tracked by #64
marten-seemann opened this issue Oct 8, 2022 · 3 comments
Open
Tracked by #64
Assignees
Labels
effort/days Estimated to take multiple days, but less than a week kind/enhancement A net-new feature or improvement to an existing feature P0 Critical: Tackled by core team ASAP

Comments

@marten-seemann
Copy link
Contributor

The test plan will test that the libp2p handshake completes in the expected number of roundtrips. For example:

  • the QUIC handshake should take 1 RTT
  • the TCP handshake should take 4 RTTs (1. 3-way TCP handshake, 2. multistream negotiation of security protocol, 3. security handshake, 4. muxer negotiation)
  • when using early muxer negotiation (Tracking Issue: early muxer selection go-libp2p#1789), the TCP handshake only takes 3 RTTs

This can easily extended to test that moving the security protocol into the multiaddr (libp2p/specs#353) saves another RTT.

The test plan will need to build on the cross-version test (or maybe the cross-implementation test). This will allow us to assert that while new go-libp2p versions make use of all the performance improvements and handshaking takes fewer RTTs, we're still remain backwards-compatible.

In the long term, this test will probably replace the ping test plan, as it tests strictly more than the ping test.

@marten-seemann marten-seemann added kind/enhancement A net-new feature or improvement to an existing feature P0 Critical: Tackled by core team ASAP effort/days Estimated to take multiple days, but less than a week labels Oct 8, 2022
@marten-seemann marten-seemann self-assigned this Oct 8, 2022
@marten-seemann
Copy link
Contributor Author

This effort is currently blocked by testground/testground#1488.

@marten-seemann
Copy link
Contributor Author

With the new wo-testground setup (we really need a better name for that…) this should be not too difficult to implement. I hacked a PoC in the rtt-test branch, although that code is by no means clean.

There are 2 main things we need to solve / standardize:

  1. We need a launcher script (to be mounted into the container) that runs some setup before the node is started (executing the tc command to get netem to apply an RTT to the interface).
  2. We need to specify the name of a results directory (/results?) and a JSON format how we export the measurements. I suggest exporting both the handshake latency and the latency determined via ping.

We can then check that the handshake latency matches what we expect. From my initial test, it looks like with a 100ms RTT, we end up with non-ambiguous results (e.g. a handshake that’s supposed to take 6 RTTs would take 615ms). We’ll need to check that this also holds on CI (reliably!). As long as the value is closer to N than to N+1, we should be on the safe side.

@p-shahi
Copy link
Member

p-shahi commented Jun 29, 2023

deferring this in favor of the work in #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/days Estimated to take multiple days, but less than a week kind/enhancement A net-new feature or improvement to an existing feature P0 Critical: Tackled by core team ASAP
Projects
None yet
Development

No branches or pull requests

3 participants