lordcheng10 commented on a change in pull request #3061:
URL: https://github.com/apache/bookkeeper/pull/3061#discussion_r810511346
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongLongPairHashMap.java
##########
@@ -220,22 +329,36 @@ public void forEach(BiConsumerLongPair processor) {
}
// A section is a portion of the hash map that is covered by a single
+ @Setter
@SuppressWarnings("serial")
private static final class Section extends StampedLock {
// Keys and values are stored interleaved in the table array
private volatile long[] table;
private volatile int capacity;
private volatile int size;
- private int usedBuckets;
- private int resizeThreshold;
-
- Section(int capacity) {
+ private volatile int usedBuckets;
+ private int resizeThresholdUp;
+ private int resizeThresholdBelow;
+ private volatile float mapFillFactor;
Review comment:
For another example, during runtime, the consumption of memory resources
increases due to a brief increase in traffic. At this time, we can temporarily
adjust these parameters to release some free memory resources.
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/util/collections/ConcurrentLongLongPairHashMap.java
##########
@@ -220,22 +329,36 @@ public void forEach(BiConsumerLongPair processor) {
}
// A section is a portion of the hash map that is covered by a single
+ @Setter
@SuppressWarnings("serial")
private static final class Section extends StampedLock {
// Keys and values are stored interleaved in the table array
private volatile long[] table;
private volatile int capacity;
private volatile int size;
- private int usedBuckets;
- private int resizeThreshold;
-
- Section(int capacity) {
+ private volatile int usedBuckets;
+ private int resizeThresholdUp;
+ private int resizeThresholdBelow;
+ private volatile float mapFillFactor;
Review comment:
@eolivelli
The purpose of this PR is to solve the problem of pendingAcks taking up too
much memory in pulsar.
I would like to support dynamic configuration of these parameters in pulsar
for the following reasons:
1. If the current memory resources are relatively tight, we need to increase
the mapIdleFactor to reduce the wasted memory space, but at this time, the
number of rehashes will increase, and the time-consuming of put and remove will
increase.
2. If we want put/remove to take less time, we need to reduce mapIdleFactor,
reduce the number of rehash, and exchange space for time;
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]