-
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][broker] Use shrink map for trackerCache #19534
[improve][broker] Use shrink map for trackerCache #19534
Conversation
Signed-off-by: xiaolongran <[email protected]>
@wolfstudy Please add the following content to your PR description and select a checkbox:
|
Signed-off-by: xiaolongran <[email protected]>
|
||
public class InMemoryRedeliveryTracker implements RedeliveryTracker { | ||
|
||
private ConcurrentLongLongPairHashMap trackerCache = new ConcurrentLongLongPairHashMap(256, 1); | ||
private ConcurrentLongLongPairHashMap trackerCache = ConcurrentLongLongPairHashMap.newBuilder() | ||
.concurrencyLevel(2) |
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.
Any reason to change the 256,1 to 128,2 ?
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.
Fixed done, PTAL again
Signed-off-by: xiaolongran <[email protected]>
/pulsarbot rerun-failure-checks |
Signed-off-by: xiaolongran <[email protected]> (cherry picked from commit c0f89dc)
Signed-off-by: xiaolongran <[email protected]> (cherry picked from commit c0f89dc) (cherry picked from commit 0f455e6)
Signed-off-by: xiaolongran <[email protected]> (cherry picked from commit c0f89dc)
Signed-off-by: xiaolongran <[email protected]>
Signed-off-by: xiaolongran <[email protected]> (cherry picked from commit c0f89dc)
Motivation
Currently, the
trackerCache
uses a ConcurrentLongLongPairHashMap that does not shrink, causingtrackerCache
to occupy a large amount of memory and has no way to release it.By monitoring the market through the JVM, we can see that during that time period, Young GC and Full GC have been frequently triggered, resulting in a large delay in Young GC and Full GC, which in turn affects production and consumption.
But what is interesting is that we can see that after the Young GC and Full GC are triggered many times, the memory in the heap is not reclaimed, so the Young GC and Full GC are triggered frequently.
Therefore, based on the above background, we made a memory dump of the Broker node and found that the set of trackerCache occupies most of the memory and this part of memory uses a non-shrink map, which will never be released. For details, refer to the following dump information:
Modifications
Use shrink map for trackerCache
doc
doc-required
doc-not-needed
doc-complete