File tree 3 files changed +27
-16
lines changed
docs/reference/migration/migrate_8_0
main/java/org/elasticsearch/common/util/concurrent
test/java/org/elasticsearch/common/util/concurrent
3 files changed +27
-16
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,12 @@ provided automatic upgrading of these settings to their `cluster.remote`
11
11
counterparts. In 8.0.0, these settings have been removed. Elasticsearch will
12
12
refuse to start if you have these settings in your configuration or cluster
13
13
state.
14
+
15
+ [float]
16
+ ==== `processors` can no longer exceed the available number of processors
17
+
18
+ Previously it was possible to set the number of processors used to set the
19
+ default sizes for the thread pools to be more than the number of available
20
+ processors. As this leads to more context switches and more threads but without
21
+ an increase in the number of physical CPUs on which to schedule these additional
22
+ threads, the `processors` setting is now bounded by the number of available processors.
Original file line number Diff line number Diff line change 48
48
49
49
public class EsExecutors {
50
50
51
- private static final DeprecationLogger deprecationLogger = new DeprecationLogger (LogManager .getLogger (EsExecutors .class ));
52
-
53
51
/**
54
52
* Setting to manually set the number of available processors. This setting is used to adjust thread pool sizes per node.
55
53
*/
56
- public static final Setting <Integer > PROCESSORS_SETTING = new Setting <> (
54
+ public static final Setting <Integer > PROCESSORS_SETTING = Setting . intSetting (
57
55
"processors" ,
58
- s -> Integer .toString (Runtime .getRuntime ().availableProcessors ()),
59
- s -> {
60
- final int value = Setting .parseInt (s , 1 , "processors" );
61
- final int availableProcessors = Runtime .getRuntime ().availableProcessors ();
62
- if (value > availableProcessors ) {
63
- deprecationLogger .deprecatedAndMaybeLog (
64
- "processors" ,
65
- "setting processors to value [{}] which is more than available processors [{}] is deprecated" ,
66
- value ,
67
- availableProcessors );
68
- }
69
- return value ;
70
- },
56
+ Runtime .getRuntime ().availableProcessors (),
57
+ 1 ,
58
+ Runtime .getRuntime ().availableProcessors (),
71
59
Property .NodeScope );
72
60
73
61
/**
Original file line number Diff line number Diff line change 32
32
import static org .hamcrest .Matchers .anyOf ;
33
33
import static org .hamcrest .Matchers .containsString ;
34
34
import static org .hamcrest .Matchers .equalTo ;
35
+ import static org .hamcrest .Matchers .hasToString ;
35
36
import static org .hamcrest .Matchers .lessThan ;
37
+ import static org .hamcrest .Matchers .matchesPattern ;
38
+ import static org .hamcrest .Matchers .matchesRegex ;
36
39
37
40
/**
38
41
* Tests for EsExecutors and its components like EsAbortPolicy.
@@ -388,4 +391,15 @@ public void testGetTasks() throws InterruptedException {
388
391
}
389
392
}
390
393
394
+ public void testProcessorsBound () {
395
+ final int available = Runtime .getRuntime ().availableProcessors ();
396
+ final int processors = randomIntBetween (available + 1 , Integer .MAX_VALUE );
397
+ final Settings settings = Settings .builder ().put ("processors" , processors ).build ();
398
+ final IllegalArgumentException e =
399
+ expectThrows (IllegalArgumentException .class , () -> EsExecutors .PROCESSORS_SETTING .get (settings ));
400
+ assertThat (
401
+ e ,
402
+ hasToString (containsString ("Failed to parse value [" + processors + "] for setting [processors] must be <= " + available )));
403
+ }
404
+
391
405
}
You can’t perform that action at this time.
0 commit comments