waitinfuture commented on code in PR #2358:
URL:
https://github.com/apache/incubator-celeborn/pull/2358#discussion_r1522371472
##########
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:
I agree that for almost all cases the actual data pushed is smaller than
`pushBufferMaxSize`, and that's why I suggested to compare with
`pushBufferMaxSize/(1 + factor)`.
--
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]