Skip to content

Commit 096791e

Browse files
[DOCS] Disk space aware threadpool merge scheduler (elastic#130465) (elastic#130468)
This documents the new threadpool-based merge scheduler, which is disk space aware, and blocks merges when disk space is low. The code changes were mostly introduced in elastic#120869 and elastic#127613 .
1 parent a73f2a8 commit 096791e

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

docs/reference/elasticsearch/configuration-reference/thread-pool-settings.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ $$$search-throttled$$$`search_throttled`
5656
`flush`
5757
: For [flush](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-flush) and [translog](/reference/elasticsearch/index-settings/translog.md) `fsync` operations. Thread pool type is `scaling` with a keep-alive of `5m` and a default maximum size of `min(5, (`[`# of allocated processors`](#node.processors)`) / 2)`.
5858

59+
`merge`
60+
: For [merge](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-modules-merge.html) operations of all the shards on the node. Thread pool type is `scaling` with a keep-alive of `5m` and a default maximum size of [`# of allocated processors`](#node.processors).
61+
5962
`force_merge`
60-
: For [force merge](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge) operations. Thread pool type is `fixed` with a size of `max(1, (`[`# of allocated processors`](#node.processors)`) / 8)` and an unbounded queue size.
63+
: For waiting on blocking [force merge](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-indices-forcemerge) operations. Thread pool type is `fixed` with a size of `max(1, (`[`# of allocated processors`](#node.processors)`) / 8)` and an unbounded queue size.
6164

6265
`management`
6366
: For cluster management. Thread pool type is `scaling` with a keep-alive of `5m` and a default maximum size of `5`.

docs/reference/elasticsearch/index-settings/merge.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,32 @@ The merge process uses auto-throttling to balance the use of hardware resources
1313

1414
## Merge scheduling [merge-scheduling]
1515

16-
The merge scheduler (ConcurrentMergeScheduler) controls the execution of merge operations when they are needed. Merges run in separate threads, and when the maximum number of threads is reached, further merges will wait until a merge thread becomes available.
16+
The merge scheduler controls the execution of merge operations when they are needed.
17+
Merges run on the dedicated `merge` thread pool.
18+
Smaller merges are prioritized over larger ones, across all shards on the node.
19+
Merges are disk IO throttled so that bursts, while merging activity is otherwise low, are smoothed out in order to not impact indexing throughput.
20+
There is no limit on the number of merges that can be enqueued for execution on the thread pool.
21+
However, beyond a certain per-shard limit, after merging is completely disk IO un-throttled, indexing for the shard will itself be throttled until merging catches up.
1722

18-
The merge scheduler supports the following *dynamic* setting:
23+
The available disk space is periodically monitored, such that no new merge tasks are scheduled for execution when the available disk space is low.
24+
This is in order to prevent that the temporary disk space, which is required while merges are executed, completely fills up the disk space on the node.
25+
26+
The merge scheduler supports the following *dynamic* settings:
1927

2028
`index.merge.scheduler.max_thread_count`
21-
: The maximum number of threads on a single shard that may be merging at once. Defaults to `Math.max(1, Math.min(4, <<node.processors, node.processors>> / 2))` which works well for a good solid-state-disk (SSD). If your index is on spinning platter drives instead, decrease this to 1.
29+
: The maximum number of threads on a **single** shard that may be merging at once. Defaults to `Math.max(1, Math.min(4, <<node.processors, node.processors>> / 2))` which works well for a good solid-state-disk (SSD). If your index is on spinning platter drives instead, decrease this to 1.
30+
31+
`indices.merge.disk.check_interval`
32+
: The time interval for checking the available disk space. Defaults to `5s`.
33+
34+
`indices.merge.disk.watermark.high`
35+
: Controls the disk usage watermark, which defaults to `95%`, beyond which no merge tasks can start execution.
36+
The disk usage tally includes the estimated temporary disk space still required by all the currently executing merge tasks.
37+
Any merge task scheduled *before* the limit is reached continues execution, even if the limit is exceeded while executing
38+
(merge tasks are not aborted).
39+
40+
`indices.merge.disk.watermark.high.max_headroom`
41+
: Controls the max headroom for the merge disk usage watermark, in case it is specified as percentage or ratio values.
42+
Defaults to `100GB` when `indices.merge.disk.watermark.high` is not explicitly set.
43+
This caps the amount of free disk space before merge scheduling is blocked.
2244

0 commit comments

Comments
 (0)