You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@celeborn.apache.org by "ErikFang (via GitHub)" <gi...@apache.org> on 2024/01/02 15:13:56 UTC

Re: [PR] [CELEBORN-1201] Optimize memory usage of cache in partition sorter [incubator-celeborn]

ErikFang commented on code in PR #2194:
URL: https://github.com/apache/incubator-celeborn/pull/2194#discussion_r1439542916


##########
worker/src/main/java/org/apache/celeborn/service/deploy/worker/storage/PartitionFilesSorter.java:
##########
@@ -127,6 +129,13 @@ public PartitionFilesSorter(
         ThreadUtils.newDaemonCachedThreadPool(
             "worker-file-sorter-execute", conf.partitionSorterThreads(), 120);
 
+    indexCache =
+        CacheBuilder.newBuilder()
+            .concurrencyLevel(conf.partitionSorterThreads())
+            .expireAfterAccess(conf.partitionSorterIndexExpire(), TimeUnit.MILLISECONDS)
+            .maximumSize(indexCacheSize)

Review Comment:
   how about using maximumWeight() instead and number of ShuffleBlockInfos as weight?
   
   ```suggestion
               .maximumWeight(indexCacheSize)
               .weigher(new Weigher<String, Map<Integer, List<ShuffleBlockInfo>>>() {
                 @Override
                 public int weigh(String key, Map<Integer, List<ShuffleBlockInfo>> infoMap) {
                   return infoMap.values().stream().mapToInt(List::size).sum();
                 }
               })
   ```



-- 
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: issues-unsubscribe@celeborn.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org