This is an automated email from the ASF dual-hosted git repository.

rickyma pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git


The following commit(s) were added to refs/heads/master by this push:
     new fbcddbe3f [#1885] improvement(server): release usedMemory as soon as 
possible after buffer is released (#1886)
fbcddbe3f is described below

commit fbcddbe3f776db3c02494e516ed9ae9697c8db2f
Author: xianjingfeng <xianjingfeng...@gmail.com>
AuthorDate: Wed Jul 10 17:08:11 2024 +0800

    [#1885] improvement(server): release usedMemory as soon as possible after 
buffer is released (#1886)
    
    ### What changes were proposed in this pull request?
    
    Release `usedMemory` as soon as possible after the buffer is released.
    
    ### Why are the changes needed?
    
    For better performance.
    Fix: #1885
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Manual testing.
---
 .../java/org/apache/uniffle/server/buffer/ShuffleBufferManager.java  | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git 
a/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBufferManager.java
 
b/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBufferManager.java
index ed0c2136d..60c37d053 100644
--- 
a/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBufferManager.java
+++ 
b/server/src/main/java/org/apache/uniffle/server/buffer/ShuffleBufferManager.java
@@ -708,8 +708,6 @@ public class ShuffleBufferManager {
 
     Map<Integer, AtomicLong> shuffleIdToSizeMap = shuffleSizeMap.get(appId);
     for (int shuffleId : shuffleIds) {
-      long size = 0;
-
       RangeMap<Integer, ShuffleBuffer> bufferRangeMap = 
shuffleIdToBuffers.remove(shuffleId);
       if (bufferRangeMap == null) {
         continue;
@@ -719,10 +717,9 @@ public class ShuffleBufferManager {
         for (ShuffleBuffer buffer : buffers) {
           buffer.release();
           ShuffleServerMetrics.gaugeTotalPartitionNum.dec();
-          size += buffer.getSize();
+          releaseMemory(buffer.getSize(), false, false);
         }
       }
-      releaseMemory(size, false, false);
       if (shuffleIdToSizeMap != null) {
         shuffleIdToSizeMap.remove(shuffleId);
       }

Reply via email to