-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[improve][misc] Optimize TLS performance by omitting extra buffer copies #23115
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After Netty 4.1.111.Final, it's no longer necessary to make buffer copies when TLS is enabled. netty/netty#14086 contains the fix
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #23115 +/- ##
============================================
- Coverage 73.57% 73.44% -0.13%
- Complexity 32624 33229 +605
============================================
Files 1877 1919 +42
Lines 139502 144113 +4611
Branches 15299 15746 +447
============================================
+ Hits 102638 105844 +3206
- Misses 28908 30158 +1250
- Partials 7956 8111 +155
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Technoboy-
approved these changes
Aug 6, 2024
nikhil-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Aug 8, 2024
…ies (apache#23115) (cherry picked from commit 1db3c5f) (cherry picked from commit 6b68e9e)
srinath-ctds
pushed a commit
to datastax/pulsar
that referenced
this pull request
Aug 12, 2024
…ies (apache#23115) (cherry picked from commit 1db3c5f) (cherry picked from commit 6b68e9e)
Denovo1998
pushed a commit
to Denovo1998/pulsar
that referenced
this pull request
Aug 17, 2024
grssam
pushed a commit
to grssam/pulsar
that referenced
this pull request
Sep 4, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
category/performance
Performance issues fix or improvements
cherry-picked/branch-3.0
cherry-picked/branch-3.3
doc-not-needed
Your PR changes do not impact docs
ready-to-test
release/3.0.7
release/3.3.2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
In Pulsar, there has been a long time workaround (#2464) for a Netty SslHandler issue where the input ByteBuf instances get mutated. After Netty 4.1.111.Final, it's no longer necessary to make buffer copies when TLS is enabled. This change on Netty side netty/netty#14086 contains the fix.
Modifications
Since the Pulsar client might get used with an older Netty version, it's necessary to detect that the Netty version contains the fix. The simplest way to detect Netty 4.1.111.Final is by checking for existence of the class
io.netty.handler.ssl.SslHandlerCoalescingBufferQueue
since that class was extracted from an inner class in 4.1.111.Final.Instead of referencing
ByteBufPair.ENCODER
andByteBufPair.COPYING_ENCODER
directly, useByteBufPair.getEncoder(tlsEnabled)
to choose the correct encoder. The COPYING_ENCODER will only be used if an older Netty version is detected. This could be the case when a client application uses the pulsar-client-original maven dependency and the application uses an older Netty version.Documentation
doc
doc-required
doc-not-needed
doc-complete