diff --git a/docs/reference/cluster/nodes-info.asciidoc b/docs/reference/cluster/nodes-info.asciidoc index 5706ef3fd93..39e0a22c8be 100644 --- a/docs/reference/cluster/nodes-info.asciidoc +++ b/docs/reference/cluster/nodes-info.asciidoc @@ -33,7 +33,7 @@ By default, it returns all attributes and core settings for a node. ==== {api-path-parms-title} ``:: - (Optional, string) Limits the information returned to the specific metrics. + (Optional, string) Limits the information returned to the specific metrics. A comma-separated list of the following options: + -- @@ -46,14 +46,14 @@ By default, it returns all attributes and core settings for a node. Statistics about ingest preprocessing. `jvm`:: - JVM stats, memory pool information, garbage collection, buffer pools, number + JVM stats, memory pool information, garbage collection, buffer pools, number of loaded/unloaded classes. `os`:: Operating system stats, load average, mem, swap. - + `plugins`:: - Details about the installed plugins and modules per node. The following + Details about the installed plugins and modules per node. The following information are available for each plugin and module: + --- @@ -61,20 +61,20 @@ By default, it returns all attributes and core settings for a node. * `version`: version of Elasticsearch the plugin was built for * `description`: short description of the plugin's purpose * `classname`: fully-qualified class name of the plugin's entry point - * `has_native_controller`: whether or not the plugin has a native controller + * `has_native_controller`: whether or not the plugin has a native controller process --- - + `process`:: Process statistics, memory consumption, cpu usage, open file descriptors. `settings`:: - + `thread_pool`:: - Statistics about each thread pool, including current size, queue and + Statistics about each thread pool, including current size, queue and rejected tasks - + `transport`:: Transport statistics about sent and received bytes in cluster communication. -- @@ -113,7 +113,7 @@ include::{docdir}/rest-api/common-parms.asciidoc[tag=node-id] `version`:: {es} version running on this node. -The `os` flag can be set to retrieve information that concern the operating +The `os` flag can be set to retrieve information that concern the operating system: `os.refresh_interval_in_millis`:: @@ -132,12 +132,12 @@ system: Number of processors available to the Java virtual machine `os.allocated_processors`:: - The number of processors actually used to calculate thread pool size. This - number can be set with the `processors` setting of a node and defaults to - the number of processors reported by the OS. In both cases this number will - never be larger than 32. + The number of processors actually used to calculate thread pool size. This + number can be set with the <> + setting of a node and defaults to the number of processors reported by + the OS. -The `process` flag can be set to retrieve information that concern the current +The `process` flag can be set to retrieve information that concern the current running process: `process.refresh_interval_in_millis`:: @@ -185,7 +185,7 @@ The `_all` flag can be set to return all the information - or you can omit it. [[cluster-nodes-info-api-example-plugins]] ===== Example for plugins metric -If `plugins` is specified, the result will contain details about the installed +If `plugins` is specified, the result will contain details about the installed plugins and modules: [source,console] @@ -256,7 +256,7 @@ The API returns the following response: [[cluster-nodes-info-api-example-ingest]] ===== Example for ingest metric -If `ingest` is specified, the response contains details about the available +If `ingest` is specified, the response contains details about the available processors per node: [source,console] @@ -344,4 +344,4 @@ The API returns the following response: // TESTRESPONSE[s/"build_hash": "587409e"/"build_hash": $body.$_path/] // TESTRESPONSE[s/"roles": \[[^\]]*\]/"roles": $body.$_path/] // TESTRESPONSE[s/"attributes": \{[^\}]*\}/"attributes": $body.$_path/] -// TESTRESPONSE[s/"processors": \[[^\]]*\]/"processors": $body.$_path/] \ No newline at end of file +// TESTRESPONSE[s/"processors": \[[^\]]*\]/"processors": $body.$_path/] diff --git a/docs/reference/index-modules/merge.asciidoc b/docs/reference/index-modules/merge.asciidoc index cc0613ec287..38f40853db3 100644 --- a/docs/reference/index-modules/merge.asciidoc +++ b/docs/reference/index-modules/merge.asciidoc @@ -25,7 +25,7 @@ The merge scheduler supports the following _dynamic_ setting: The maximum number of threads on a single shard that may be merging at once. Defaults to - `Math.max(1, Math.min(4, Runtime.getRuntime().availableProcessors() / 2))` - which works well for a good solid-state-disk (SSD). If your index is on - spinning platter drives instead, decrease this to 1. + `Math.max(1, Math.min(4, <> / 2))` which + works well for a good solid-state-disk (SSD). If your index is on spinning + platter drives instead, decrease this to 1. diff --git a/docs/reference/modules/threadpool.asciidoc b/docs/reference/modules/threadpool.asciidoc index 41bcee254ac..c6d7fd0ad94 100644 --- a/docs/reference/modules/threadpool.asciidoc +++ b/docs/reference/modules/threadpool.asciidoc @@ -15,8 +15,8 @@ There are several thread pools, but the important ones include: `search`:: For count/search/suggest operations. Thread pool type is - `fixed_auto_queue_size` with a size of - `int((# of available_processors * 3) / 2) + 1`, and initial queue_size of + `fixed_auto_queue_size` with a size of `int((`<>` * 3) / 2) + 1`, and initial queue_size of `1000`. [[search-throttled]]`search_throttled`:: @@ -26,7 +26,7 @@ There are several thread pools, but the important ones include: `get`:: For get operations. Thread pool type is `fixed` - with a size of `# of available processors`, + with a size of <>, queue_size of `1000`. `analyze`:: @@ -35,40 +35,45 @@ There are several thread pools, but the important ones include: `write`:: For single-document index/delete/update and bulk requests. Thread pool type - is `fixed` with a size of `# of available processors`, queue_size of `200`. - The maximum size for this pool is `1 + # of available processors`. + is `fixed` with a size of <>, + queue_size of `200`. The maximum size for this pool is `1 + ` + <>. `snapshot`:: For snapshot/restore operations. Thread pool type is `scaling` with a - keep-alive of `5m` and a max of `min(5, (# of available processors)/2)`. + keep-alive of `5m` and a max of `min(5, (`<>`)/2)`. `warmer`:: For segment warm-up operations. Thread pool type is `scaling` with a - keep-alive of `5m` and a max of `min(5, (# of available processors)/2)`. + keep-alive of `5m` and a max of `min(5, (`<>`)/2)`. `refresh`:: For refresh operations. Thread pool type is `scaling` with a - keep-alive of `5m` and a max of `min(10, (# of available processors)/2)`. + keep-alive of `5m` and a max of `min(10, (`<>`)/2)`. `listener`:: Mainly for java client executing of action when listener threaded is set to `true`. Thread pool type is `scaling` with a default max of - `min(10, (# of available processors)/2)`. + `min(10, (`<>`)/2)`. `fetch_shard_started`:: For listing shard states. Thread pool type is `scaling` with keep-alive of `5m` and a default maximum - size of `2 * # of available processors`. + size of `2 * `<>. `fetch_shard_store`:: For listing shard stores. Thread pool type is `scaling` with keep-alive of `5m` and a default maximum - size of `2 * # of available processors`. + size of `2 * `<>. `flush`:: - For <>, <>, and <> `fsync` operations. - Thread pool type is `scaling` with a keep-alive of `5m` and a default - maximum size of `min(5, (# of available processors)/2)`. + For <>, <>, and + <> `fsync` operations. Thread pool type is + `scaling` with a keep-alive of `5m` and a default maximum size of `min(5, (` + <>`) / 2)`. `force_merge`:: For <> operations. @@ -189,13 +194,13 @@ thread_pool: -------------------------------------------------- [float] -[[processors]] -=== Processors setting +[[node.processors]] +=== Allocated processors setting -The number of processors is automatically detected, and the thread pool -settings are automatically set based on it. In some cases it can be -useful to override the number of detected processors. This can be done -by explicitly setting the `node.processors` setting. +The number of processors is automatically detected, and the thread pool settings +are automatically set based on it. In some cases it can be useful to override +the number of detected processors. This can be done by explicitly setting the +`node.processors` setting. [source,yaml] -------------------------------------------------- diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java index cdccc5aa893..ac6741d37fc 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/http/netty4/Netty4HttpServerTransport.java @@ -127,7 +127,7 @@ public class Netty4HttpServerTransport extends AbstractHttpServerTransport { }, s -> Setting.parseInt(s, 2, Integer.MAX_VALUE, SETTING_KEY_HTTP_NETTY_MAX_COMPOSITE_BUFFER_COMPONENTS), Property.NodeScope); public static final Setting SETTING_HTTP_WORKER_COUNT = new Setting<>("http.netty.worker_count", - (s) -> Integer.toString(EsExecutors.numberOfProcessors(s) * 2), + (s) -> Integer.toString(EsExecutors.allocatedProcessors(s) * 2), (s) -> Setting.parseInt(s, 1, "http.netty.worker_count"), Property.NodeScope); public static final Setting SETTING_HTTP_NETTY_RECEIVE_PREDICTOR_SIZE = diff --git a/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java b/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java index a8446227579..09d843ff6be 100644 --- a/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java +++ b/modules/transport-netty4/src/main/java/org/elasticsearch/transport/netty4/Netty4Transport.java @@ -83,7 +83,7 @@ public class Netty4Transport extends TcpTransport { public static final Setting WORKER_COUNT = new Setting<>("transport.netty.worker_count", - (s) -> Integer.toString(EsExecutors.numberOfProcessors(s) * 2), + (s) -> Integer.toString(EsExecutors.allocatedProcessors(s) * 2), (s) -> Setting.parseInt(s, 1, "transport.netty.worker_count"), Property.NodeScope); public static final Setting NETTY_RECEIVE_PREDICTOR_SIZE = Setting.byteSizeSetting( diff --git a/plugins/transport-nio/src/main/java/org/elasticsearch/transport/nio/NioTransportPlugin.java b/plugins/transport-nio/src/main/java/org/elasticsearch/transport/nio/NioTransportPlugin.java index 4bbbd7f6d8b..84097e3a079 100644 --- a/plugins/transport-nio/src/main/java/org/elasticsearch/transport/nio/NioTransportPlugin.java +++ b/plugins/transport-nio/src/main/java/org/elasticsearch/transport/nio/NioTransportPlugin.java @@ -57,7 +57,7 @@ public class NioTransportPlugin extends Plugin implements NetworkPlugin { public static final Setting NIO_WORKER_COUNT = new Setting<>("transport.nio.worker_count", - (s) -> Integer.toString(EsExecutors.numberOfProcessors(s) * 2), + (s) -> Integer.toString(EsExecutors.allocatedProcessors(s) * 2), (s) -> Setting.parseInt(s, 1, "transport.nio.worker_count"), Setting.Property.NodeScope); public static final Setting NIO_HTTP_WORKER_COUNT = intSetting("http.nio.worker_count", 0, 0, Setting.Property.NodeScope); diff --git a/server/src/main/java/org/elasticsearch/action/search/TransportMultiSearchAction.java b/server/src/main/java/org/elasticsearch/action/search/TransportMultiSearchAction.java index 66aa15c5692..3ea90cfd5c1 100644 --- a/server/src/main/java/org/elasticsearch/action/search/TransportMultiSearchAction.java +++ b/server/src/main/java/org/elasticsearch/action/search/TransportMultiSearchAction.java @@ -43,7 +43,7 @@ import java.util.function.LongSupplier; public class TransportMultiSearchAction extends HandledTransportAction { - private final int availableProcessors; + private final int allocatedProcessors; private final ThreadPool threadPool; private final ClusterService clusterService; private final LongSupplier relativeTimeProvider; @@ -55,18 +55,18 @@ public class TransportMultiSearchAction extends HandledTransportAction) MultiSearchRequest::new); this.threadPool = threadPool; this.clusterService = clusterService; - this.availableProcessors = EsExecutors.numberOfProcessors(settings); + this.allocatedProcessors = EsExecutors.allocatedProcessors(settings); this.relativeTimeProvider = System::nanoTime; this.client = client; } TransportMultiSearchAction(ThreadPool threadPool, ActionFilters actionFilters, TransportService transportService, - ClusterService clusterService, int availableProcessors, + ClusterService clusterService, int allocatedProcessors, LongSupplier relativeTimeProvider, NodeClient client) { super(MultiSearchAction.NAME, transportService, actionFilters, (Writeable.Reader) MultiSearchRequest::new); this.threadPool = threadPool; this.clusterService = clusterService; - this.availableProcessors = availableProcessors; + this.allocatedProcessors = allocatedProcessors; this.relativeTimeProvider = relativeTimeProvider; this.client = client; } @@ -80,7 +80,7 @@ public class TransportMultiSearchAction extends HandledTransportAction searchRequestSlots = new ConcurrentLinkedQueue<>(); @@ -104,11 +104,10 @@ public class TransportMultiSearchAction extends HandledTransportAction() { + bytePage = build(type, maxBytePageCount, allocatedProcessors, new AbstractRecyclerC() { @Override public byte[] newInstance() { return new byte[BYTE_PAGE_SIZE]; @@ -110,7 +110,7 @@ public class PageCacheRecycler { }); final int maxIntPageCount = (int) (intsWeight * maxPageCount / totalWeight); - intPage = build(type, maxIntPageCount, availableProcessors, new AbstractRecyclerC() { + intPage = build(type, maxIntPageCount, allocatedProcessors, new AbstractRecyclerC() { @Override public int[] newInstance() { return new int[INT_PAGE_SIZE]; @@ -122,7 +122,7 @@ public class PageCacheRecycler { }); final int maxLongPageCount = (int) (longsWeight * maxPageCount / totalWeight); - longPage = build(type, maxLongPageCount, availableProcessors, new AbstractRecyclerC() { + longPage = build(type, maxLongPageCount, allocatedProcessors, new AbstractRecyclerC() { @Override public long[] newInstance() { return new long[LONG_PAGE_SIZE]; @@ -134,7 +134,7 @@ public class PageCacheRecycler { }); final int maxObjectPageCount = (int) (objectsWeight * maxPageCount / totalWeight); - objectPage = build(type, maxObjectPageCount, availableProcessors, new AbstractRecyclerC() { + objectPage = build(type, maxObjectPageCount, allocatedProcessors, new AbstractRecyclerC() { @Override public Object[] newInstance() { return new Object[OBJECT_PAGE_SIZE]; diff --git a/server/src/main/java/org/elasticsearch/common/util/concurrent/EsExecutors.java b/server/src/main/java/org/elasticsearch/common/util/concurrent/EsExecutors.java index 681e1ac72cf..b154c9f5911 100644 --- a/server/src/main/java/org/elasticsearch/common/util/concurrent/EsExecutors.java +++ b/server/src/main/java/org/elasticsearch/common/util/concurrent/EsExecutors.java @@ -62,7 +62,9 @@ public class EsExecutors { Property.NodeScope); /** - * Setting to manually set the number of available processors. This setting is used to adjust thread pool sizes per node. + * Setting to manually control the number of allocated processors. This setting is used to adjust thread pool sizes per node. The + * default value is {@link Runtime#availableProcessors()} but should be manually controlled if not all processors on the machine are + * available to Elasticsearch (e.g., because of CPU limits). */ public static final Setting NODE_PROCESSORS_SETTING = new Setting<>( "node.processors", @@ -86,14 +88,13 @@ public class EsExecutors { } /** - * Returns the number of available processors. Defaults to - * {@link Runtime#availableProcessors()} but can be overridden by passing a {@link Settings} - * instance with the key "processors" set to the desired value. + * Returns the number of allocated processors. Defaults to {@link Runtime#availableProcessors()} but can be overridden by passing a + * {@link Settings} instance with the key {@code node.processors} set to the desired value. * - * @param settings a {@link Settings} instance from which to derive the available processors - * @return the number of available processors + * @param settings a {@link Settings} instance from which to derive the allocated processors + * @return the number of allocated processors */ - public static int numberOfProcessors(final Settings settings) { + public static int allocatedProcessors(final Settings settings) { return NODE_PROCESSORS_SETTING.get(settings); } diff --git a/server/src/main/java/org/elasticsearch/index/MergeSchedulerConfig.java b/server/src/main/java/org/elasticsearch/index/MergeSchedulerConfig.java index 72f3d8d120b..e1af1a15fac 100644 --- a/server/src/main/java/org/elasticsearch/index/MergeSchedulerConfig.java +++ b/server/src/main/java/org/elasticsearch/index/MergeSchedulerConfig.java @@ -22,6 +22,7 @@ package org.elasticsearch.index; import org.apache.lucene.index.ConcurrentMergeScheduler; import org.elasticsearch.common.settings.Setting; import org.elasticsearch.common.settings.Setting.Property; +import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.util.concurrent.EsExecutors; /** @@ -36,7 +37,7 @@ import org.elasticsearch.common.util.concurrent.EsExecutors; *
  • index.merge.scheduler.max_thread_count: * * The maximum number of threads that may be merging at once. Defaults to - * Math.max(1, Math.min(4, Runtime.getRuntime().availableProcessors() / 2)) + * Math.max(1, Math.min(4, {@link EsExecutors#allocatedProcessors(Settings)} / 2)) * which works well for a good solid-state-disk (SSD). If your index is on * spinning platter drives instead, decrease this to 1. * @@ -54,7 +55,7 @@ public final class MergeSchedulerConfig { public static final Setting MAX_THREAD_COUNT_SETTING = new Setting<>("index.merge.scheduler.max_thread_count", - (s) -> Integer.toString(Math.max(1, Math.min(4, EsExecutors.numberOfProcessors(s) / 2))), + (s) -> Integer.toString(Math.max(1, Math.min(4, EsExecutors.allocatedProcessors(s) / 2))), (s) -> Setting.parseInt(s, 1, "index.merge.scheduler.max_thread_count"), Property.Dynamic, Property.IndexScope); public static final Setting MAX_MERGE_COUNT_SETTING = diff --git a/server/src/main/java/org/elasticsearch/monitor/os/OsService.java b/server/src/main/java/org/elasticsearch/monitor/os/OsService.java index 57306ace254..d4ec4fda795 100644 --- a/server/src/main/java/org/elasticsearch/monitor/os/OsService.java +++ b/server/src/main/java/org/elasticsearch/monitor/os/OsService.java @@ -45,7 +45,7 @@ public class OsService { public OsService(Settings settings) throws IOException { this.probe = OsProbe.getInstance(); TimeValue refreshInterval = REFRESH_INTERVAL_SETTING.get(settings); - this.info = probe.osInfo(refreshInterval.millis(), EsExecutors.numberOfProcessors(settings)); + this.info = probe.osInfo(refreshInterval.millis(), EsExecutors.allocatedProcessors(settings)); this.osStatsCache = new OsStatsCache(refreshInterval, probe.osStats()); logger.debug("using refresh_interval [{}]", refreshInterval); } diff --git a/server/src/main/java/org/elasticsearch/threadpool/ExecutorBuilder.java b/server/src/main/java/org/elasticsearch/threadpool/ExecutorBuilder.java index 3945042db50..a986f60e10d 100644 --- a/server/src/main/java/org/elasticsearch/threadpool/ExecutorBuilder.java +++ b/server/src/main/java/org/elasticsearch/threadpool/ExecutorBuilder.java @@ -49,7 +49,7 @@ public abstract class ExecutorBuilder builders = new HashMap<>(); - final int availableProcessors = EsExecutors.numberOfProcessors(settings); - final int halfProcMaxAt5 = halfNumberOfProcessorsMaxFive(availableProcessors); - final int halfProcMaxAt10 = halfNumberOfProcessorsMaxTen(availableProcessors); - final int genericThreadPoolMax = boundedBy(4 * availableProcessors, 128, 512); + final int allocatedProcessors = EsExecutors.allocatedProcessors(settings); + final int halfProcMaxAt5 = halfAllocatedProcessorsMaxFive(allocatedProcessors); + final int halfProcMaxAt10 = halfAllocatedProcessorsMaxTen(allocatedProcessors); + final int genericThreadPoolMax = boundedBy(4 * allocatedProcessors, 128, 512); builders.put(Names.GENERIC, new ScalingExecutorBuilder(Names.GENERIC, 4, genericThreadPoolMax, TimeValue.timeValueSeconds(30))); - builders.put(Names.WRITE, new FixedExecutorBuilder(settings, Names.WRITE, availableProcessors, 200)); - builders.put(Names.GET, new FixedExecutorBuilder(settings, Names.GET, availableProcessors, 1000)); + builders.put(Names.WRITE, new FixedExecutorBuilder(settings, Names.WRITE, allocatedProcessors, 200)); + builders.put(Names.GET, new FixedExecutorBuilder(settings, Names.GET, allocatedProcessors, 1000)); builders.put(Names.ANALYZE, new FixedExecutorBuilder(settings, Names.ANALYZE, 1, 16)); builders.put(Names.SEARCH, new AutoQueueAdjustingExecutorBuilder(settings, - Names.SEARCH, searchThreadPoolSize(availableProcessors), 1000, 1000, 1000, 2000)); + Names.SEARCH, searchThreadPoolSize(allocatedProcessors), 1000, 1000, 1000, 2000)); builders.put(Names.SEARCH_THROTTLED, new AutoQueueAdjustingExecutorBuilder(settings, Names.SEARCH_THROTTLED, 1, 100, 100, 100, 200)); builders.put(Names.MANAGEMENT, new ScalingExecutorBuilder(Names.MANAGEMENT, 1, 5, TimeValue.timeValueMinutes(5))); @@ -187,10 +187,10 @@ public class ThreadPool implements Scheduler { builders.put(Names.WARMER, new ScalingExecutorBuilder(Names.WARMER, 1, halfProcMaxAt5, TimeValue.timeValueMinutes(5))); builders.put(Names.SNAPSHOT, new ScalingExecutorBuilder(Names.SNAPSHOT, 1, halfProcMaxAt5, TimeValue.timeValueMinutes(5))); builders.put(Names.FETCH_SHARD_STARTED, - new ScalingExecutorBuilder(Names.FETCH_SHARD_STARTED, 1, 2 * availableProcessors, TimeValue.timeValueMinutes(5))); + new ScalingExecutorBuilder(Names.FETCH_SHARD_STARTED, 1, 2 * allocatedProcessors, TimeValue.timeValueMinutes(5))); builders.put(Names.FORCE_MERGE, new FixedExecutorBuilder(settings, Names.FORCE_MERGE, 1, -1)); builders.put(Names.FETCH_SHARD_STORE, - new ScalingExecutorBuilder(Names.FETCH_SHARD_STORE, 1, 2 * availableProcessors, TimeValue.timeValueMinutes(5))); + new ScalingExecutorBuilder(Names.FETCH_SHARD_STORE, 1, 2 * allocatedProcessors, TimeValue.timeValueMinutes(5))); for (final ExecutorBuilder builder : customBuilders) { if (builders.containsKey(builder.name())) { throw new IllegalArgumentException("builder with name [" + builder.name() + "] already exists"); @@ -436,20 +436,20 @@ public class ThreadPool implements Scheduler { return Math.min(max, Math.max(min, value)); } - static int halfNumberOfProcessorsMaxFive(int numberOfProcessors) { - return boundedBy((numberOfProcessors + 1) / 2, 1, 5); + static int halfAllocatedProcessorsMaxFive(final int allocatedProcessors) { + return boundedBy((allocatedProcessors + 1) / 2, 1, 5); } - static int halfNumberOfProcessorsMaxTen(int numberOfProcessors) { - return boundedBy((numberOfProcessors + 1) / 2, 1, 10); + static int halfAllocatedProcessorsMaxTen(final int allocatedProcessors) { + return boundedBy((allocatedProcessors + 1) / 2, 1, 10); } - static int twiceNumberOfProcessors(int numberOfProcessors) { - return boundedBy(2 * numberOfProcessors, 2, Integer.MAX_VALUE); + static int twiceAllocatedProcessors(final int allocatedProcessors) { + return boundedBy(2 * allocatedProcessors, 2, Integer.MAX_VALUE); } - public static int searchThreadPoolSize(int availableProcessors) { - return ((availableProcessors * 3) / 2) + 1; + public static int searchThreadPoolSize(final int allocatedProcessors) { + return ((allocatedProcessors * 3) / 2) + 1; } class LoggingRunnable implements Runnable { diff --git a/server/src/test/java/org/elasticsearch/threadpool/FixedThreadPoolTests.java b/server/src/test/java/org/elasticsearch/threadpool/FixedThreadPoolTests.java index f31e4bdaef1..4f85507747b 100644 --- a/server/src/test/java/org/elasticsearch/threadpool/FixedThreadPoolTests.java +++ b/server/src/test/java/org/elasticsearch/threadpool/FixedThreadPoolTests.java @@ -34,7 +34,7 @@ public class FixedThreadPoolTests extends ESThreadPoolTestCase { final String threadPoolName = randomThreadPool(ThreadPool.ThreadPoolType.FIXED); // some of the fixed thread pool are bound by the number of // cores so we can not exceed that - final int size = randomIntBetween(1, EsExecutors.numberOfProcessors(Settings.EMPTY)); + final int size = randomIntBetween(1, EsExecutors.allocatedProcessors(Settings.EMPTY)); final int queueSize = randomIntBetween(1, 16); final long rejections = randomIntBetween(1, 16); diff --git a/server/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java b/server/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java index 5f4c15bc30c..e90a2f108f4 100644 --- a/server/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java +++ b/server/src/test/java/org/elasticsearch/threadpool/ScalingThreadPoolTests.java @@ -108,12 +108,12 @@ public class ScalingThreadPoolTests extends ESThreadPoolTestCase { final Map> sizes = new HashMap<>(); sizes.put(ThreadPool.Names.GENERIC, n -> ThreadPool.boundedBy(4 * n, 128, 512)); sizes.put(ThreadPool.Names.MANAGEMENT, n -> 5); - sizes.put(ThreadPool.Names.FLUSH, ThreadPool::halfNumberOfProcessorsMaxFive); - sizes.put(ThreadPool.Names.REFRESH, ThreadPool::halfNumberOfProcessorsMaxTen); - sizes.put(ThreadPool.Names.WARMER, ThreadPool::halfNumberOfProcessorsMaxFive); - sizes.put(ThreadPool.Names.SNAPSHOT, ThreadPool::halfNumberOfProcessorsMaxFive); - sizes.put(ThreadPool.Names.FETCH_SHARD_STARTED, ThreadPool::twiceNumberOfProcessors); - sizes.put(ThreadPool.Names.FETCH_SHARD_STORE, ThreadPool::twiceNumberOfProcessors); + sizes.put(ThreadPool.Names.FLUSH, ThreadPool::halfAllocatedProcessorsMaxFive); + sizes.put(ThreadPool.Names.REFRESH, ThreadPool::halfAllocatedProcessorsMaxTen); + sizes.put(ThreadPool.Names.WARMER, ThreadPool::halfAllocatedProcessorsMaxFive); + sizes.put(ThreadPool.Names.SNAPSHOT, ThreadPool::halfAllocatedProcessorsMaxFive); + sizes.put(ThreadPool.Names.FETCH_SHARD_STARTED, ThreadPool::twiceAllocatedProcessors); + sizes.put(ThreadPool.Names.FETCH_SHARD_STORE, ThreadPool::twiceAllocatedProcessors); return sizes.get(threadPoolName).apply(numberOfProcessors); } diff --git a/server/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java b/server/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java index 537d39dd9d2..db9914829a8 100644 --- a/server/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java +++ b/server/src/test/java/org/elasticsearch/threadpool/UpdateThreadPoolSettingsTests.java @@ -61,7 +61,7 @@ public class UpdateThreadPoolSettingsTests extends ESThreadPoolTestCase { } public void testWriteThreadPoolsMaxSize() throws InterruptedException { - final int maxSize = 1 + EsExecutors.numberOfProcessors(Settings.EMPTY); + final int maxSize = 1 + EsExecutors.allocatedProcessors(Settings.EMPTY); final int tooBig = randomIntBetween(1 + maxSize, Integer.MAX_VALUE); // try to create a too big thread pool @@ -88,7 +88,7 @@ public class UpdateThreadPoolSettingsTests extends ESThreadPoolTestCase { private static int getExpectedThreadPoolSize(Settings settings, String name, int size) { if (name.equals(ThreadPool.Names.WRITE)) { - return Math.min(size, EsExecutors.numberOfProcessors(settings)); + return Math.min(size, EsExecutors.allocatedProcessors(settings)); } else { return size; } @@ -192,7 +192,7 @@ public class UpdateThreadPoolSettingsTests extends ESThreadPoolTestCase { new ScalingExecutorBuilder( "my_pool1", 1, - EsExecutors.numberOfProcessors(Settings.EMPTY), + EsExecutors.allocatedProcessors(Settings.EMPTY), TimeValue.timeValueMinutes(1)); final FixedExecutorBuilder fixed = new FixedExecutorBuilder(Settings.EMPTY, "my_pool2", 1, 1); diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java index fb2a572830b..134eec7498e 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/Watcher.java @@ -537,12 +537,12 @@ public class Watcher extends Plugin implements SystemIndexPlugin, ScriptPlugin, * @return A number between 5 and the number of processors */ static int getWatcherThreadPoolSize(final Settings settings) { - return getWatcherThreadPoolSize(Node.NODE_DATA_SETTING.get(settings), EsExecutors.numberOfProcessors(settings)); + return getWatcherThreadPoolSize(Node.NODE_DATA_SETTING.get(settings), EsExecutors.allocatedProcessors(settings)); } - static int getWatcherThreadPoolSize(final boolean isDataNode, final int numberOfProcessors) { + static int getWatcherThreadPoolSize(final boolean isDataNode, final int allocatedProcessors) { if (isDataNode) { - final long size = Math.max(Math.min(5 * numberOfProcessors, 50), numberOfProcessors); + final long size = Math.max(Math.min(5 * allocatedProcessors, 50), allocatedProcessors); return Math.toIntExact(size); } else { return 1;