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

benches: add benchmark for concurrent connections #430

Merged
merged 4 commits into from
Aug 31, 2021

Conversation

niklasad1
Copy link
Member

@niklasad1 niklasad1 commented Aug 5, 2021

The code is a little bit !DRY but that's because the benchmark itself needs to construct the concrete client.

Interestingly, HTTP server throughput seems to be worse than the WS server for example if one compares one round trip with two connections it's around 15x slower on my machine.

When it comes to WebSockets the actual initial "connection" is excluded but it should at least show how efficient/slow polling each connections is... It's around 10x slower on my machine .

Concurrent connections with one roundtrip

sync/http_concurrent_connections/2
                        time:   [1.3427 ms 1.3654 ms 1.3898 ms]
                        change: [-2.9408% -1.1348% +0.6740%] (p = 0.24 > 0.05)
                        No change in performance detected.
Found 2 outliers among 100 measurements (2.00%)
  2 (2.00%) high mild
sync/http_concurrent_connections/4
                        time:   [7.3308 ms 8.0426 ms 8.7470 ms]
                        change: [+159.46% +186.47% +212.97%] (p = 0.00 < 0.05)
                        Performance has regressed.
sync/http_concurrent_connections/8
                        time:   [24.833 ms 25.393 ms 26.038 ms]
                        change: [+388.94% +401.38% +414.71%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) high mild
  7 (7.00%) high severe
sync/http_concurrent_connections/16
                        time:   [9.3473 ms 9.4424 ms 9.5436 ms]
                        change: [-9.7526% -7.9180% -6.2010%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 1 outliers among 100 measurements (1.00%)
  1 (1.00%) high severe
sync/http_concurrent_connections/32
                        time:   [18.828 ms 19.172 ms 19.545 ms]
                        change: [-8.1828% -5.7520% -3.2709%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  6 (6.00%) high mild
  1 (1.00%) high severe
sync/http_concurrent_connections/64
                        time:   [38.144 ms 38.908 ms 39.692 ms]
                        change: [-12.634% -9.7696% -6.9251%] (p = 0.00 < 0.05)
                        Performance has improved.

Roundtrip with one client

sync/http_round_trip    time:   [85.041 us 95.603 us 107.21 us]
                        change: [-48.697% -41.492% -32.649%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
  4 (4.00%) high mild
  2 (2.00%) high severe

@niklasad1 niklasad1 marked this pull request as ready for review August 17, 2021 14:43
@dvdplm dvdplm requested a review from maciejhirsz August 30, 2021 12:40
Copy link
Contributor

@maciejhirsz maciejhirsz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Out of curiosity, does the HTTP client preserve the connection to the server, or does it make a new connection on each request?

benches/bench.rs Outdated Show resolved Hide resolved
@niklasad1
Copy link
Member Author

niklasad1 commented Aug 31, 2021

Out of curiosity, does the HTTP client preserve the connection to the server, or does it make a new connection on each request?

Good question, the answer is that it depends but we create the new clients in the bench setup (not included in benchmark) so it might or might not reuse the existing connection because the clients are used several times. If the client was only used for one request then I think we could be sure that the client didn't reuse an already existing connection.

@niklasad1 niklasad1 merged commit c49f4af into master Aug 31, 2021
@niklasad1 niklasad1 deleted the na-concurrent-connections-bench branch August 31, 2021 08:35
niklasad1 added a commit that referenced this pull request Oct 14, 2021
* benches: add benchmark for concurrent connections

* address grumbles: use array into_iter
niklasad1 added a commit that referenced this pull request Oct 14, 2021
* benches: add benchmark for concurrent connections

* address grumbles: use array into_iter
niklasad1 added a commit that referenced this pull request Oct 14, 2021
* benches: add benchmark for concurrent connections

* address grumbles: use array into_iter
niklasad1 added a commit that referenced this pull request Oct 15, 2021
* benches: add benchmark for concurrent connections

* address grumbles: use array into_iter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants