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

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


The following commit(s) were added to refs/heads/main by this push:
     new 85b9f8fadc [MINOR] Add an error message to the memory file storage 
ratio check in MemoryManager
85b9f8fadc is described below

commit 85b9f8fadc08da456af1d117f0172187108d0188
Author: ForVic <[email protected]>
AuthorDate: Wed Nov 11 13:25:19 2026 +0800

    [MINOR] Add an error message to the memory file storage ratio check in 
MemoryManager
    
    ### What changes were proposed in this pull request?
    
    Add an error message to the `MemoryManager` startup check that requires 
`celeborn.worker.directMemoryRatioToResume` to be greater than 
`celeborn.worker.directMemoryRatioForReadBuffer` + 
`celeborn.worker.directMemoryRatioForMemoryFileStorage`. The pause ratio check 
just above it already reports a message like this.
    
    ### Why are the changes needed?
    
    I hit this while benchmarking the memory storage tier. I set 
`celeborn.worker.directMemoryRatioForMemoryFileStorage=0.5` and left the other 
ratios at their defaults (resume 0.7, read buffer 0.35). The worker failed to 
start, and the log only showed:
    
    ```
    ERROR [main] Worker: Initialize worker failed.
    java.lang.IllegalArgumentException
            at 
com.google.common.base.Preconditions.checkArgument(Preconditions.java:131)
            at 
org.apache.celeborn.service.deploy.worker.memory.MemoryManager.<init>(MemoryManager.java:168)
    ```
    
    I had to read `MemoryManager` to find out which settings conflicted. With 
this change the error says:
    
    ```
    java.lang.IllegalArgumentException: Invalid config, 
celeborn.worker.directMemoryRatioToResume(0.7) should be greater than 
celeborn.worker.directMemoryRatioForReadBuffer(0.35) + 
celeborn.worker.directMemoryRatioForMemoryFileStorage(0.5)
    ```
    
    ### Does this PR resolve a correctness bug?
    
    - [ ] Yes
    
    ### Does this PR introduce _any_ user-facing change?
    
    - [x] Yes
    
    Only the error message when the worker fails to start with this invalid 
configuration.
    
    ### How was this patch tested?
    
    Added a test to `MemoryManagerSuite` that checks the new message. 
`MemoryManagerSuite` passes locally (9 tests, JDK 17).
    
    Closes #3953 from ForVic/ForVic/memory-file-storage-ratio-message.
    
    Authored-by: ForVic <[email protected]>
    Signed-off-by: Nicholas Jiang <[email protected]>
---
 .../service/deploy/worker/memory/MemoryManager.java       | 10 +++++++++-
 .../service/deploy/memory/MemoryManagerSuite.scala        | 15 ++++++++++++++-
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git 
a/worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/MemoryManager.java
 
b/worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/MemoryManager.java
index 2f73d62c83..422a6b6a92 100644
--- 
a/worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/MemoryManager.java
+++ 
b/worker/src/main/java/org/apache/celeborn/service/deploy/worker/memory/MemoryManager.java
@@ -166,7 +166,15 @@ public class MemoryManager {
     Preconditions.checkArgument(pausePushDataRatio > directMemoryResumeRatio);
     if (memoryFileStorageRatio > 0) {
       Preconditions.checkArgument(
-          directMemoryResumeRatio > (readBufferRatio + 
memoryFileStorageRatio));
+          directMemoryResumeRatio > (readBufferRatio + memoryFileStorageRatio),
+          String.format(
+              "Invalid config, %s(%s) should be greater than %s(%s) + %s(%s)",
+              CelebornConf.WORKER_DIRECT_MEMORY_RATIO_RESUME().key(),
+              directMemoryResumeRatio,
+              CelebornConf.WORKER_DIRECT_MEMORY_RATIO_FOR_READ_BUFFER().key(),
+              readBufferRatio,
+              
CelebornConf.WORKER_DIRECT_MEMORY_RATIO_FOR_MEMORY_FILE_STORAGE().key(),
+              memoryFileStorageRatio));
     }
 
     maxSortMemory = ((long) (maxDirectMemory * maxSortMemRatio));
diff --git 
a/worker/src/test/scala/org/apache/celeborn/service/deploy/memory/MemoryManagerSuite.scala
 
b/worker/src/test/scala/org/apache/celeborn/service/deploy/memory/MemoryManagerSuite.scala
index 0b95384bc8..df0676ea77 100644
--- 
a/worker/src/test/scala/org/apache/celeborn/service/deploy/memory/MemoryManagerSuite.scala
+++ 
b/worker/src/test/scala/org/apache/celeborn/service/deploy/memory/MemoryManagerSuite.scala
@@ -27,7 +27,7 @@ import org.scalatest.concurrent.Futures.{interval, timeout}
 
 import org.apache.celeborn.CelebornFunSuite
 import org.apache.celeborn.common.CelebornConf
-import 
org.apache.celeborn.common.CelebornConf.{WORKER_DIRECT_MEMORY_RATIO_PAUSE_RECEIVE,
 WORKER_DIRECT_MEMORY_RATIO_PAUSE_REPLICATE}
+import 
org.apache.celeborn.common.CelebornConf.{WORKER_DIRECT_MEMORY_RATIO_FOR_MEMORY_FILE_STORAGE,
 WORKER_DIRECT_MEMORY_RATIO_FOR_READ_BUFFER, 
WORKER_DIRECT_MEMORY_RATIO_PAUSE_RECEIVE, 
WORKER_DIRECT_MEMORY_RATIO_PAUSE_REPLICATE, WORKER_DIRECT_MEMORY_RATIO_RESUME}
 import org.apache.celeborn.common.protocol.TransportModuleConstants
 import org.apache.celeborn.service.deploy.worker.memory.MemoryManager
 import 
org.apache.celeborn.service.deploy.worker.memory.MemoryManager.{MemoryPressureListener,
 ServingState}
@@ -52,6 +52,19 @@ class MemoryManagerSuite extends CelebornFunSuite {
         s"should be greater than 
${WORKER_DIRECT_MEMORY_RATIO_PAUSE_RECEIVE.key}(0.95)")
   }
 
+  test("Init MemoryManager with too large memory file storage ratio") {
+    // resume (0.7) must be greater than read buffer (0.35) + memory file 
storage (0.5)
+    val conf = new 
CelebornConf().set(WORKER_DIRECT_MEMORY_RATIO_FOR_MEMORY_FILE_STORAGE, 0.5)
+    val caught =
+      intercept[IllegalArgumentException] {
+        MemoryManager.initialize(conf)
+      }
+    assert(
+      caught.getMessage == s"Invalid config, 
${WORKER_DIRECT_MEMORY_RATIO_RESUME.key}(0.7) " +
+        s"should be greater than 
${WORKER_DIRECT_MEMORY_RATIO_FOR_READ_BUFFER.key}(0.35) + " +
+        s"${WORKER_DIRECT_MEMORY_RATIO_FOR_MEMORY_FILE_STORAGE.key}(0.5)")
+  }
+
   test("[CELEBORN-888] Test MemoryManager#currentServingState trigger case") {
     val conf = new CelebornConf()
     try {

Reply via email to