Skip to content

Commit e2be583

Browse files
committed
use static max heap threshold 100
Signed-off-by: Xun Zhang <xunzh@amazon.com>
1 parent 96a6404 commit e2be583

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

plugin/src/main/java/org/opensearch/ml/breaker/MemoryCircuitBreaker.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public class MemoryCircuitBreaker extends ThresholdCircuitBreaker<Short> {
1818
// TODO: make this value configurable as cluster setting
1919
private static final String ML_MEMORY_CB = "Memory Circuit Breaker";
2020
public static final short DEFAULT_JVM_HEAP_USAGE_THRESHOLD = 85;
21+
public static final short JVM_HEAP_MAX_THRESHOLD = 100; // when threshold is 100, this CB check is ignored
2122
private final JvmService jvmService;
2223
private volatile Integer jvmHeapMemThreshold = 85;
2324

@@ -45,6 +46,6 @@ public String getName() {
4546

4647
@Override
4748
public boolean isOpen() {
48-
return getThreshold() < 100 && jvmService.stats().getMem().getHeapUsedPercent() > getThreshold();
49+
return getThreshold() < JVM_HEAP_MAX_THRESHOLD && jvmService.stats().getMem().getHeapUsedPercent() > getThreshold();
4950
}
5051
}

plugin/src/test/java/org/opensearch/ml/model/MLModelManagerTests.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -1018,13 +1018,13 @@ private MLRegisterModelInput mockPretrainedInput() {
10181018

10191019
private MLRegisterModelInput mockRemoteModelInput(boolean isHidden) {
10201020
return MLRegisterModelInput
1021-
.builder()
1022-
.modelName(modelName)
1023-
.version(version)
1024-
.modelGroupId("modelGroupId")
1025-
.modelFormat(modelFormat)
1026-
.functionName(FunctionName.REMOTE)
1027-
.deployModel(true)
1028-
.build();
1021+
.builder()
1022+
.modelName(modelName)
1023+
.version(version)
1024+
.modelGroupId("modelGroupId")
1025+
.modelFormat(modelFormat)
1026+
.functionName(FunctionName.REMOTE)
1027+
.deployModel(true)
1028+
.build();
10291029
}
10301030
}

0 commit comments

Comments
 (0)