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 DefaultMutualHandshakeContext* benchmarks #4277

Merged
merged 3 commits into from
Jul 15, 2024

Conversation

rzikm
Copy link
Member

@rzikm rzikm commented Jun 19, 2024

This PR adds microbenchmarks for mutually authenticated SslStream pair which uses SslStreamCertificateContext on the server side. This allows benchmarking TLS resume with client certificates (supported on Windows, newly supported on Linux in .NET 9 via dotnet/runtime#102656)

@rzikm
Copy link
Member Author

rzikm commented Jun 20, 2024

CI Failures seem to be unrelated.

@rzikm rzikm enabled auto-merge (squash) June 21, 2024 13:11
@rzikm rzikm requested a review from adamsitnik July 9, 2024 08:17
@rzikm rzikm disabled auto-merge July 15, 2024 07:52
@rzikm rzikm closed this Jul 15, 2024
@rzikm rzikm reopened this Jul 15, 2024
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @rzikm !

};

using (var sslClient = new SslStream(client, leaveInnerStreamOpen: true, delegate { return true; }))
using (var sslServer = new SslStream(server, leaveInnerStreamOpen: true, delegate { return true; }))
{
await Task.WhenAll(
sslClient.AuthenticateAsClientAsync("localhost", null, SslProtocols.None, checkCertificateRevocation: false),
sslClient.AuthenticateAsClientAsync("localhost", requireClientCert ? new X509CertificateCollection() { _clientCert } : null, SslProtocols.None, checkCertificateRevocation: false),
Copy link
Member

Choose a reason for hiding this comment

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

just for my education: Why do you want to create a new instance of X509CertificateCollection every time the benchmark is called? Does this reflect typical real-life scenario?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to mirror what we do in non-context benchmarks for SslStream.

ClientCertificates = requireClientCert ? new X509CertificateCollection() { _clientCert } : null,

Typical real-world scenarios would probably always use the overload accepting Ssl(Client|Server)AuthenticationOptions and reuse a single instance of it for multiple connections, or always create new instance entirely from scratch (as we do in linked source code).

@rzikm
Copy link
Member Author

rzikm commented Jul 15, 2024

@adamsitnik I can't merge this PR because of a failed GH check on performance-ci, I don't think the failures are related to my changes. Can you override it and merge this?

@adamsitnik
Copy link
Member

Can you override it and merge this?

I don't have such permissions anymore.

But @caaavik-msft or @LoopedBard3 or @DrewScoggins should be able to do that.

@LoopedBard3 LoopedBard3 merged commit 0dd22f3 into dotnet:main Jul 15, 2024
42 of 63 checks passed
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.

4 participants