-
Notifications
You must be signed in to change notification settings - Fork 888
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] Prevent memory copy and heap memory allocation when read entry #4259
base: master
Are you sure you want to change the base?
Conversation
@lhotari @eolivelli @hangc0276 @zymap Could you please take a look? |
I am not familiar with netty reference count. I have two questions.
|
|
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessorV3.java
Outdated
Show resolved
Hide resolved
@@ -350,6 +344,43 @@ protected void registerEvent(boolean failed, OpStatsLogger statsLogger, Stopwatc | |||
} | |||
} | |||
|
|||
ByteString parseToByteString(ByteBuf entryBody) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parse
naming isn't optimal. A better name is unsafeWrapAsByteString
etc. It's also worth adding a comment that the lifecycle of the ByteString continues to be managed with the ByteBuf lifecycle (retain/release).
@@ -350,6 +344,43 @@ protected void registerEvent(boolean failed, OpStatsLogger statsLogger, Stopwatc | |||
} | |||
} | |||
|
|||
ByteString parseToByteString(ByteBuf entryBody) { | |||
ByteString aggregated = null; | |||
ByteString piece; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having this variable introduced at this level isn't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense to me, fixed
Motivation
Prevent memory copy when read entry.
Changes
(Describe: what changes you have made)
Master Issue: #