CodingCat commented on code in PR #2358:
URL:
https://github.com/apache/incubator-celeborn/pull/2358#discussion_r1519880264
##########
client-spark/common/src/main/java/org/apache/spark/shuffle/celeborn/SortBasedPusher.java:
##########
@@ -44,6 +44,73 @@
public class SortBasedPusher extends MemoryConsumer {
+ class MemoryThresholdManager {
+
+ private long maxMemoryThresholdInBytes;
+ private long currentMemoryThresholdInBytes;
+
+ private double smallPushTolerateFactor;
+
+ MemoryThresholdManager(
+ int numPartitions,
+ long sendBufferSizeInBytes,
+ long currentMemoryThresholdInBytes,
+ double smallPushTolerateFactor) {
+ this.maxMemoryThresholdInBytes = numPartitions * sendBufferSizeInBytes;
+ this.currentMemoryThresholdInBytes = currentMemoryThresholdInBytes;
+ this.smallPushTolerateFactor = smallPushTolerateFactor;
+ }
+
+ private boolean shouldGrow() {
+ boolean enoughSpace = this.currentMemoryThresholdInBytes * 2 <=
maxMemoryThresholdInBytes;
+ long shouldPushedBytes;
+ if (shouldPushedCount == 0) {
+ shouldPushedBytes = 0;
+ } else {
+ shouldPushedBytes =
+ (long) ((1 + smallPushTolerateFactor) * shouldPushedSizeInBytes /
shouldPushedCount);
+ }
+ boolean tooManyPushed = pushedMemorySizeInBytes * 1.0 / pushedCount >
shouldPushedBytes;
Review Comment:
oops, it is a typo, it should be (pushedMemorySizeInBytes * 1.0 /
pushedCount * (1 + factor) < shouldPushedBytes
but I think you are right, we can just use pushBufferMaxSize
--
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]