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

Make 'NIOSSLContext' ahead of time #1184

Merged
merged 1 commit into from
May 18, 2021
Merged

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented May 17, 2021

Motivation:

A NIOSSLContext may be used for multiple connections. Moreover,
creating NIOSSLContexts is expensive and we should avoid creating
them unnecessarily. At the moment we create one context per connection
for the client and the server.

Modifications:

  • Make NIOSSLContexts when setting up the client (rather than when
    initializing a channel).
  • Make NIOSSLContexts when preparing a server bootstrap

Result:

  • We only create NIOSSLContext once per server/client connection

Motivation:

A `NIOSSLContext` may be used for multiple connections. Moreover,
creating `NIOSSLContext`s is _expensive_ and we should avoid creating
them unnecessarily. At the moment we create one context per connection
for the client and the server.

Modifications:

- Make `NIOSSLContext`s when setting up the client (rather than when
  initializing a channel).
- Make `NIOSSLContext`s when preparing a server bootstrap

Result:

- We only create `NIOSSLContext` once per server/client connection
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label May 17, 2021
@glbrntt glbrntt requested a review from Lukasa May 17, 2021 12:42
Copy link
Contributor

@Davidde94 Davidde94 left a comment

Choose a reason for hiding this comment

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

Nice!

Copy link
Collaborator

@Lukasa Lukasa left a comment

Choose a reason for hiding this comment

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

Beautiful, this is a great patch.

@Lukasa Lukasa merged commit 17ae7a0 into grpc:main May 18, 2021
@glbrntt glbrntt deleted the gb-context-is-expensive branch May 18, 2021 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants