-
Notifications
You must be signed in to change notification settings - Fork 962
Fix Memory Leak In Netty Recycler of Bookie Client #4609
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
Fix Memory Leak In Netty Recycler of Bookie Client #4609
Conversation
| import org.apache.bookkeeper.net.BookieId; | ||
| import org.slf4j.MDC; | ||
|
|
||
| class AddCompletion extends CompletionValue implements BookkeeperInternalCallbacks.WriteCallback { |
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.
Refactoring by pulling the classes out masks the actual fix here. Can you, for this fix, leave the refactoring aside?
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.
Actually, after reviewing a bit, it kind of makes sense to split the classes in this PR, since it forces all classes to be static.
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/EntryCompletionKey.java
Outdated
Show resolved
Hide resolved
| import org.apache.bookkeeper.net.BookieId; | ||
| import org.slf4j.MDC; | ||
|
|
||
| class AddCompletion extends CompletionValue implements BookkeeperInternalCallbacks.WriteCallback { |
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.
Actually, after reviewing a bit, it kind of makes sense to split the classes in this PR, since it forces all classes to be static.
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AddCompletion.java
Show resolved
Hide resolved
bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/AddCompletion.java
Outdated
Show resolved
Hide resolved
* make recycler static to avoid OOM problem * Fixed missing license headers * Fixed checkstyle * More checkstyle --------- Co-authored-by: fanjianye <fanjianye@bigo.sg> Co-authored-by: Matteo Merli <mmerli@apache.org>
* make recycler static to avoid OOM problem * Fixed missing license headers * Fixed checkstyle * More checkstyle --------- Co-authored-by: fanjianye <fanjianye@bigo.sg> Co-authored-by: Matteo Merli <mmerli@apache.org> (cherry picked from commit 137cc94)
* make recycler static to avoid OOM problem * Fixed missing license headers * Fixed checkstyle * More checkstyle --------- Co-authored-by: fanjianye <fanjianye@bigo.sg> Co-authored-by: Matteo Merli <mmerli@apache.org> (cherry picked from commit 137cc94)
Main Issue: apache/pulsar#24355
Motivation
There is a huge memory leak risk in netty recycler of bookie client . The issue and analysis is show here: apache/pulsar#24355
Changes
Currently, each perChannelBookieClient has its own recycler.
After modification, All the completionKey and completionValue is no longer the inner class of perChannelBookieClient, and each perChannelBookieClient would share the same recycler.
Notice: after the modification, it is more important to set a appropriate
io.netty.recycler.maxCapacityPerThreadconfig. Because I have tested that if we do not rely on cache object, the read and write performance would have a little decrease. Since all the channel in bkClient share the same recycler, we should make the config = add entry qps * add entry average latency.