Skip to content

Commit 1399586

Browse files
[ML] Increase default queue_capacity to 10_000 and decrease max queue_capacity to 100_000 (#115041)
* Increase default queue capacity and decrease max queue capacity * Update docs/changelog/115041.yaml * Update tests to match new constants
1 parent 728ac0c commit 1399586

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

docs/changelog/115041.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
pr: 115041
2+
summary: Increase default `queue_capacity` to 10_000 and decrease max `queue_capacity`
3+
to 100_000
4+
area: Machine Learning
5+
type: enhancement
6+
issues: []

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/action/StartTrainedModelDeploymentAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public class StartTrainedModelDeploymentAction extends ActionType<CreateTrainedM
7171
public static final AllocationStatus.State DEFAULT_WAITFOR_STATE = AllocationStatus.State.STARTED;
7272
public static final int DEFAULT_NUM_ALLOCATIONS = 1;
7373
public static final int DEFAULT_NUM_THREADS = 1;
74-
public static final int DEFAULT_QUEUE_CAPACITY = 1024;
74+
public static final int DEFAULT_QUEUE_CAPACITY = 10_000;
7575
public static final Priority DEFAULT_PRIORITY = Priority.NORMAL;
7676

7777
public StartTrainedModelDeploymentAction() {
@@ -89,7 +89,7 @@ public static class Request extends MasterNodeRequest<Request> implements ToXCon
8989
/**
9090
* If the queue is created then we can OOM when we create the queue.
9191
*/
92-
private static final int MAX_QUEUE_CAPACITY = 1_000_000;
92+
private static final int MAX_QUEUE_CAPACITY = 100_000;
9393

9494
public static final ParseField MODEL_ID = new ParseField("model_id");
9595
public static final ParseField DEPLOYMENT_ID = new ParseField("deployment_id");

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ml/action/StartTrainedModelDeploymentRequestTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static Request createRandom() {
6767
request.setNumberOfAllocations(randomIntBetween(1, 8));
6868
}
6969
if (randomBoolean()) {
70-
request.setQueueCapacity(randomIntBetween(1, 1000000));
70+
request.setQueueCapacity(randomIntBetween(1, 100_000));
7171
}
7272
if (randomBoolean()) {
7373
request.setPriority(randomFrom(Priority.values()).toString());
@@ -168,7 +168,7 @@ public void testValidate_GivenQueueCapacityIsNegative() {
168168

169169
public void testValidate_GivenQueueCapacityIsAtLimit() {
170170
Request request = createRandom();
171-
request.setQueueCapacity(1_000_000);
171+
request.setQueueCapacity(100_000);
172172

173173
ActionRequestValidationException e = request.validate();
174174

@@ -177,12 +177,12 @@ public void testValidate_GivenQueueCapacityIsAtLimit() {
177177

178178
public void testValidate_GivenQueueCapacityIsOverLimit() {
179179
Request request = createRandom();
180-
request.setQueueCapacity(1_000_001);
180+
request.setQueueCapacity(100_001);
181181

182182
ActionRequestValidationException e = request.validate();
183183

184184
assertThat(e, is(not(nullValue())));
185-
assertThat(e.getMessage(), containsString("[queue_capacity] must be less than 1000000"));
185+
assertThat(e.getMessage(), containsString("[queue_capacity] must be less than 100000"));
186186
}
187187

188188
public void testValidate_GivenTimeoutIsNegative() {
@@ -234,6 +234,6 @@ public void testDefaults() {
234234
assertThat(request.getNumberOfAllocations(), nullValue());
235235
assertThat(request.computeNumberOfAllocations(), equalTo(1));
236236
assertThat(request.getThreadsPerAllocation(), equalTo(1));
237-
assertThat(request.getQueueCapacity(), equalTo(1024));
237+
assertThat(request.getQueueCapacity(), equalTo(10_000));
238238
}
239239
}

0 commit comments

Comments
 (0)