Skip to content

Commit a32950b

Browse files
[8.19] Set default processor allocation for test clusters (#133204) (#133213)
* Set default processor allocation for test clusters (#133204) Setting the number of processors available for node to adequately size thread pools. Related to #130612 * Lowering the allocations during update to fit within available processors --------- Co-authored-by: Jonathan Buttner <[email protected]>
1 parent d739724 commit a32950b

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalTestClustersPlugin.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@ public void apply(Project project) {
3434
|| buildParams.getBwcVersions().unreleasedInfo(version) == null
3535
);
3636

37-
if (shouldConfigureTestClustersWithOneProcessor()) {
38-
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
39-
.getExtensions()
40-
.getByName(TestClustersPlugin.EXTENSION_NAME);
41-
testClusters.configureEach(elasticsearchCluster -> elasticsearchCluster.setting("node.processors", "1"));
42-
}
37+
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
38+
.getExtensions()
39+
.getByName(TestClustersPlugin.EXTENSION_NAME);
40+
// Limit the number of allocated processors for all nodes to 2 in the cluster by default.
41+
// This is to ensure that the tests run consistently across different environments.
42+
String processorCount = shouldConfigureTestClustersWithOneProcessor() ? "1" : "2";
43+
testClusters.configureEach(elasticsearchCluster -> elasticsearchCluster.setting("node.processors", processorCount));
4344
}
4445

4546
private boolean shouldConfigureTestClustersWithOneProcessor() {

test/test-clusters/src/main/java/org/elasticsearch/test/cluster/local/DefaultSettingsProvider.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public Map<String, String> get(LocalNodeSpec nodeSpec) {
4242
}
4343
}
4444

45+
// Limit the number of allocated processors for all nodes in the cluster by default.
46+
// This is to ensure that the tests run consistently across different environments.
47+
settings.put("node.processors", "2");
48+
4549
// Default the watermarks to absurdly low to prevent the tests from failing on nodes without enough disk space
4650
settings.put("cluster.routing.allocation.disk.watermark.low", "1b");
4751
settings.put("cluster.routing.allocation.disk.watermark.high", "1b");

x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/CreateFromDeploymentIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void testAttachToDeployment() throws IOException {
5151
var results = infer(inferenceId, List.of("washing machine"));
5252
assertNotNull(results.get("sparse_embedding"));
5353

54-
var updatedNumAllocations = randomIntBetween(1, 10);
54+
var updatedNumAllocations = randomIntBetween(1, 2);
5555
var updatedEndpointConfig = updateEndpoint(inferenceId, updatedEndpointConfig(updatedNumAllocations), TaskType.SPARSE_EMBEDDING);
5656
assertThat(
5757
updatedEndpointConfig.get("service_settings"),
@@ -128,7 +128,7 @@ public void testAttachWithModelId() throws IOException {
128128
var results = infer(inferenceId, List.of("washing machine"));
129129
assertNotNull(results.get("sparse_embedding"));
130130

131-
var updatedNumAllocations = randomIntBetween(1, 10);
131+
var updatedNumAllocations = randomIntBetween(1, 2);
132132
var updatedEndpointConfig = updateEndpoint(inferenceId, updatedEndpointConfig(updatedNumAllocations), TaskType.SPARSE_EMBEDDING);
133133
assertThat(
134134
updatedEndpointConfig.get("service_settings"),

0 commit comments

Comments
 (0)