You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by do...@apache.org on 2026/09/24 15:21:39 UTC

(accumulo) branch main updated: Reduce idle FATE worker polling interval (#6557)

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

DomGarguilo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 67c5c00a7e Reduce idle FATE worker polling interval (#6557)
67c5c00a7e is described below

commit 67c5c00a7eefe7ed61477531e7a535d206f8550c
Author: Dom G. <do...@apache.org>
AuthorDate: Thu Sep 24 11:21:33 2026 -0400

    Reduce idle FATE worker polling interval (#6557)
    
    increases the sleep interval to 50ms to vastly decrease the idle usage of a fate worker. The new interval is derived from the tryTransfer timeout (100ms) so that it is still guaranteed the worker will poll at least once while the work finder is waiting to hand off
---
 .../main/java/org/apache/accumulo/core/fate/FateExecutor.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/core/src/main/java/org/apache/accumulo/core/fate/FateExecutor.java b/core/src/main/java/org/apache/accumulo/core/fate/FateExecutor.java
index 54e9e302ec..22fcaf67c8 100644
--- a/core/src/main/java/org/apache/accumulo/core/fate/FateExecutor.java
+++ b/core/src/main/java/org/apache/accumulo/core/fate/FateExecutor.java
@@ -72,6 +72,12 @@ public class FateExecutor<T> {
   private static final Logger log = LoggerFactory.getLogger(FateExecutor.class);
   private final Logger runnerLog = LoggerFactory.getLogger(TransactionRunner.class);
 
+  // How long the work finder waits for a worker to take a FateId before trying again.
+  private static final long TRANSFER_TIMEOUT_MS = 100;
+  // Idle workers sleep instead of blocking, so keep this at half the transfer timeout. Then even
+  // a single worker polls at least once while the work finder is waiting.
+  private static final long IDLE_POLL_MS = TRANSFER_TIMEOUT_MS / 2;
+
   private final T environment;
   private final Fate<T> fate;
   private final Thread workFinder;
@@ -344,7 +350,8 @@ public class FateExecutor<T> {
                   // threads were busy, the queue size was 100, and there are three runnable things
                   // in the store. Do not want to keep scanning the store adding those same 3
                   // runnable things until the queue is full.
-                  if (workQueue.tryTransfer(fateIdStatus.getFateId(), 100, MILLISECONDS)) {
+                  if (workQueue.tryTransfer(fateIdStatus.getFateId(), TRANSFER_TIMEOUT_MS,
+                      MILLISECONDS)) {
                     break;
                   }
                 } catch (InterruptedException e) {
@@ -398,7 +405,7 @@ public class FateExecutor<T> {
           FateId unreservedFateId = workQueue.poll();
 
           if (unreservedFateId == null) {
-            Thread.sleep(1);
+            Thread.sleep(IDLE_POLL_MS);
             continue;
           }
           var optionalopStore = fate.getStore().tryReserve(unreservedFateId);