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

Fix throughput bench issues and add documentation #4130

Merged
merged 4 commits into from
Aug 2, 2023

Conversation

tinzh
Copy link
Contributor

@tinzh tinzh commented Aug 2, 2023

Description of changes:

s2n-tls's send() and recv() in the benches currently ignore partial reads and writes; this PR adds functionality to properly handle partial reads/writes.

Also, this PR adds more documentation for throughput benchmarks and more clearly calls out how throughput benches are round-trip and single-threaded.

Testing:

Results from benching don't seem to have changed. To test, run all scripts and benchmarks.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@tinzh tinzh requested review from camshaft and jmayclin August 2, 2023 18:35
jmayclin
jmayclin previously approved these changes Aug 2, 2023
@@ -32,6 +32,8 @@ To bench with AWS-LC, Amazon's custom libcrypto implementation, first run `scrip

The benchmarks can be run with the `cargo bench` command. Criterion will auto-generate an HTML report in `target/criterion/`.

Throughput benchmarks measure round-trip throughput with the client and server connections in the same thread for symmetry. In practice, throughput for a single connection would be ~4x higher than the values from the benchmarks.
Copy link
Contributor

@jmayclin jmayclin Aug 2, 2023

Choose a reason for hiding this comment

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

I don't think I totally understand this statement? Wouldn't it just be 2x higher?

I'm also wary of telling people what their numbers "might" look like. In fact, it might be a good idea to have a general disclaimer about how we abstract away a lot of the complexity that exists in real systems(network IO) so customers should always run real benchmarks themselves, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Throughput being one-way vs round-trip makes it 2x higher, and having send/recv be in the same thread instead of two different threads makes it 2x higher on top of that, multiplying to 4x.

Putting a general disclaimer in an obvious place seems to be a good idea; I'll add it at the top.

@jmayclin jmayclin dismissed their stale review August 2, 2023 18:43

comment on readme.

@@ -32,6 +32,8 @@ To bench with AWS-LC, Amazon's custom libcrypto implementation, first run `scrip

The benchmarks can be run with the `cargo bench` command. Criterion will auto-generate an HTML report in `target/criterion/`.

Throughput benchmarks measure round-trip throughput with the client and server connections in the same thread for symmetry. In practice, throughput for a single connection would be ~4x higher than the values from the benchmarks.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would probably say up to ~4x, since it depends on if the sender and receiver are split into multiple threads or not. There's also factors like RTT, buffer sizes, CPU asymmetry, and link rates that will limit it as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to "could theoretically be up to ~4x higher"

@tinzh tinzh enabled auto-merge (squash) August 2, 2023 20:18
@tinzh tinzh merged commit ab8f107 into aws:main Aug 2, 2023
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