You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@uniffle.apache.org by GitBox <gi...@apache.org> on 2022/08/19 07:52:39 UTC

[GitHub] [incubator-uniffle] jerqi commented on a diff in pull request #167: Limit the speed of memory release when drop pending events

jerqi commented on code in PR #167:
URL: https://github.com/apache/incubator-uniffle/pull/167#discussion_r949905016


##########
server/src/main/java/org/apache/uniffle/server/ShuffleFlushManager.java:
##########
@@ -111,26 +114,28 @@ public ShuffleFlushManager(ShuffleServerConf shuffleServerConf, String shuffleSe
     processEventThread.setName("ProcessEventThread");
     processEventThread.setDaemon(true);
     processEventThread.start();
-    // todo: extract a class named Service, and support stop method
-    Thread thread = new Thread("PendingEventProcessThread") {
-      @Override
-      public void run() {
-        for (; ; ) {
-          try {
-            processPendingEvents();
-            processPendingEventIndex = (processPendingEventIndex + 1) % 1000;
-            if (processPendingEventIndex == 0) {
-              // todo: get sleep interval from configuration
-              Uninterruptibles.sleepUninterruptibly(1, TimeUnit.SECONDS);
-            }
-          } catch (Exception e) {
-            LOG.error(getName() + " happened exception: ", e);
+    pendingEventProcesser = Executors.newSingleThreadScheduledExecutor(
+            ThreadUtils.getThreadFactory("PendingEventProcesser-%d"));
+    long sleepInterval = shuffleServerConf.get(ShuffleServerConf.PENDING_EVENT_CHECK_INTERVAL);
+    long memoryCapacity = shuffleServerConf.getSizeAsBytes(ShuffleServerConf.SERVER_BUFFER_CAPACITY);;
+    long memoryThreshold = Math.max(memoryCapacity / 10, 1024L * 1024 * 1024);

Review Comment:
   Why do we divide by 10? 



-- 
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@uniffle.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@uniffle.apache.org
For additional commands, e-mail: issues-help@uniffle.apache.org