[improve][misc] Optimize TLS performance by omitting extra buffer copies#23115
Merged
lhotari merged 1 commit intoapache:masterfrom Aug 6, 2024
Merged
[improve][misc] Optimize TLS performance by omitting extra buffer copies#23115lhotari merged 1 commit intoapache:masterfrom
lhotari merged 1 commit intoapache:masterfrom
Conversation
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.
🚀 New features to boost your workflow:
|
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
hanmz
pushed a commit
to hanmz/pulsar
that referenced
this pull request
Feb 12, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.SslHandlerCoalescingBufferQueuesince that class was extracted from an inner class in 4.1.111.Final.Instead of referencing
ByteBufPair.ENCODERandByteBufPair.COPYING_ENCODERdirectly, 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
docdoc-requireddoc-not-neededdoc-complete