This is an automated email from the ASF dual-hosted git repository.
nicholasjiang pushed a commit to branch branch-0.6
in repository https://gitbox.apache.org/repos/asf/celeborn.git
The following commit(s) were added to refs/heads/branch-0.6 by this push:
new c34a9e0ae [CELEBORN-2265] Do not waste resources on hotpath for debug
logging in HashBasedShuffleWriter and SortBasedShuffleWriter
c34a9e0ae is described below
commit c34a9e0ae5af644ecb31ffc1c86363c32f2a0549
Author: Enrico Olivelli <[email protected]>
AuthorDate: Tue Feb 17 16:37:08 2026 +0800
[CELEBORN-2265] Do not waste resources on hotpath for debug logging in
HashBasedShuffleWriter and SortBasedShuffleWriter
### What changes were proposed in this pull request?
Compute logging message only when needed in order to save CPU cycles on the
hotpath.
### Why are the changes needed?
<img width="2561" height="687" alt="image"
src="https://github.com/user-attachments/assets/53733848-ebcd-4079-a77a-9aa38ed1e90a"
/>
### Does this PR resolve a correctness bug?
No
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
Manual testing
Closes #3603 from eolivelli/flushbuffer-logger.
Authored-by: Enrico Olivelli <[email protected]>
Signed-off-by: SteNicholas <[email protected]>
(cherry picked from commit 13cd4a9232b7f771e2314943d8614598f7d62283)
Signed-off-by: SteNicholas <[email protected]>
---
.../java/org/apache/spark/shuffle/celeborn/HashBasedShuffleWriter.java | 2 +-
.../java/org/apache/spark/shuffle/celeborn/SortBasedShuffleWriter.java | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git
a/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/HashBasedShuffleWriter.java
b/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/HashBasedShuffleWriter.java
index df0c6d1eb..49c6d6954 100644
---
a/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/HashBasedShuffleWriter.java
+++
b/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/HashBasedShuffleWriter.java
@@ -320,7 +320,7 @@ public class HashBasedShuffleWriter<K, V, C> extends
ShuffleWriter<K, V> {
private void flushSendBuffer(int partitionId, byte[] buffer, int size)
throws IOException, InterruptedException {
long start = System.nanoTime();
- logger.debug("Flush buffer, size {}.", Utils.bytesToString(size));
+ if (logger.isDebugEnabled()) logger.debug("Flush buffer, size {}.",
Utils.bytesToString(size));
dataPusher.addTask(partitionId, buffer, size);
writeMetrics.incWriteTime(System.nanoTime() - start);
}
diff --git
a/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SortBasedShuffleWriter.java
b/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SortBasedShuffleWriter.java
index b4ff4d158..e413ce42f 100644
---
a/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SortBasedShuffleWriter.java
+++
b/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SortBasedShuffleWriter.java
@@ -345,7 +345,8 @@ public class SortBasedShuffleWriter<K, V, C> extends
ShuffleWriter<K, V> {
}
private void pushGiantRecord(int partitionId, byte[] buffer, int numBytes)
throws IOException {
- logger.debug("Push giant record, size {}.", Utils.bytesToString(numBytes));
+ if (logger.isDebugEnabled())
+ logger.debug("Push giant record, size {}.",
Utils.bytesToString(numBytes));
long start = System.nanoTime();
int bytesWritten =
shuffleClient.pushData(