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

refactor(perf): use libp2p-request-response #3646

Merged
merged 41 commits into from
May 28, 2023
Merged

Conversation

mxinden
Copy link
Member

@mxinden mxinden commented Mar 20, 2023

Description

Rewrite libp2p-perf protocol using libp2p-request-response. Additionally adjust to latest conventions, e.g. the final JSON output.

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

mxinden added 4 commits March 20, 2023 10:37
- Enforces backpressure on stream creation on QUIC
- Note that this does not sequentialize stream negotiation as we are using V1Lazy

As an aside, with and without `V1Lazy`:

```
[2023-03-20T09:31:21Z INFO  perf_client] Starting: single connection requests per second benchmark.
[2023-03-20T09:31:28Z INFO  perf_client] Finsihed: sent 10000 1 bytes requests with 1 bytes response each within 6.28 s thus 1591.963270172488 req/s.
```

```
[2023-03-20T09:34:03Z INFO  perf_client] Starting: single connection requests per second benchmark.
[2023-03-20T09:37:07Z INFO  perf_client] Finsihed: sent 10000 1 bytes requests with 1 bytes response each within 183.90 s thus 54.37835611842429 req/s.
```
```
[2023-03-20T10:09:29Z INFO  perf_client] Initiating performance tests with /dns4/libp2p-perf.max-inden.de/udp/4001/quic-v1

[2023-03-20T10:09:29Z INFO  perf_client] Connection to /dns4/libp2p-perf.max-inden.de/udp/4001/quic-v1 established.

[2023-03-20T10:09:29Z INFO  perf_client] Start benchmark: single connection single channel throughput
[2023-03-20T10:09:41Z INFO  perf_client] Finished: sent 10.00 MiB in 7.60 s with 10.53 MiBit/s and received 10.00 MiB in 3.92 s with 20.41 MiBit/s

[2023-03-20T10:09:41Z INFO  perf_client] Start benchmark: single connection requests per second
[2023-03-20T10:09:48Z INFO  perf_client] Finished: sent 10000 1 bytes requests with 1 bytes response each within 6.93 s thus 1442.81 req/s
```
@mxinden
Copy link
Member Author

mxinden commented Mar 20, 2023

Sample output:

➜  perf git:(perf) cargo run --bin perf-client -- --server-address /dns4/libp2p-perf.max-inden.de/udp/4001/quic-v1
[2023-03-20T13:50:02Z INFO  perf_client] Start benchmark: round-trip-time latency
[2023-03-20T13:50:38Z INFO  perf_client] Finished: 1000 pings
[2023-03-20T13:50:38Z INFO  perf_client] - 0.0325 s median
[2023-03-20T13:50:38Z INFO  perf_client] - 0.0419 s 95th percentile
    
[2023-03-20T13:50:38Z INFO  perf_client] Start benchmark: single connection single channel throughput
[2023-03-20T13:50:48Z INFO  perf_client] Finished: sent 10.00 MiB in 7.38 s and received 10.00 MiB in 3.21 s
[2023-03-20T13:50:48Z INFO  perf_client] - 10.84 MiBit/s up
[2023-03-20T13:50:48Z INFO  perf_client] - 24.90 MiBit/s down
    
[2023-03-20T13:50:48Z INFO  perf_client] Start benchmark: single connection parallel requests per second
[2023-03-20T13:50:54Z INFO  perf_client] Finished: sent 10000 1 bytes requests with 1 bytes response each within 5.54 s
[2023-03-20T13:50:54Z INFO  perf_client] - 1803.94 req/s
    
[2023-03-20T13:50:54Z INFO  perf_client] Start benchmark: sequential connections with single request per second
[2023-03-20T13:51:01Z INFO  perf_client] Finished: established 100 connections with one 1 bytes request and one 1 bytes response within 7.23 s
[2023-03-20T13:51:01Z INFO  perf_client] - 0.0384 s 95th percentile connection establishment
[2023-03-20T13:51:01Z INFO  perf_client] - 0.0752 s 95th percentile connection establishment + one request

@mergify
Copy link
Contributor

mergify bot commented Mar 20, 2023

This pull request has merge conflicts. Could you please resolve them @mxinden? 🙏

@mxinden mxinden changed the title feat: Enforce single pending stream, req/s benchmark and colored output feat: iterate on perf protocol Mar 24, 2023
@mergify
Copy link
Contributor

mergify bot commented Apr 13, 2023

This pull request has merge conflicts. Could you please resolve them @mxinden? 🙏

@mergify
Copy link
Contributor

mergify bot commented May 14, 2023

This pull request has merge conflicts. Could you please resolve them @mxinden? 🙏

@mxinden mxinden changed the title feat: iterate on perf protocol refactor(perf): use libp2p-request-response May 26, 2023
@mxinden
Copy link
Member Author

mxinden commented May 26, 2023

@thomaseizinger can you give this pull request a review? Note that with #3990 we can easily do (breaking) changes in the future. Given that and given that it is not a production-environment component, I don't think it requires a thorough review.

In my eyes it makes sense to merge at this point in order to not accumulate even more changes into a single pull request. As is, it is a useful component. That said, I do expect more changes to come.

protocols/perf/src/bin/perf.rs Outdated Show resolved Hide resolved
protocols/perf/src/bin/perf.rs Outdated Show resolved Hide resolved
@mxinden
Copy link
Member Author

mxinden commented May 28, 2023

Switched from Noise to TLS. That was as simple as going from libp2p_noise::Config to libp2p_tls::Config. Thanks for pushing all the consistency efforts @thomaseizinger!

@mergify mergify bot merged commit 92af0d1 into libp2p:master May 28, 2023
mxinden added a commit to libp2p/test-plans that referenced this pull request May 29, 2023
@thomaseizinger
Copy link
Contributor

Switched from Noise to TLS. That was as simple as going from libp2p_noise::Config to libp2p_tls::Config. Thanks for pushing all the consistency efforts @thomaseizinger!

It is coming together!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants