Skip to content

Commit a8b22df

Browse files
[DOCS] Disk space aware threadpool merge scheduler (#130465)
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 #120869 and #127613 .
1 parent 315aba6 commit a8b22df

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
@@ -59,8 +59,11 @@ $$$search-throttled$$$`search_throttled`
5959
`flush`
6060
: 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)`.
6161

62+
`merge`
63+
: 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).
64+
6265
`force_merge`
63-
: 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.
66+
: 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.
6467

6568
`management`
6669
: 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
@@ -18,10 +18,32 @@ The merge process uses auto-throttling to balance the use of hardware resources
1818

1919
## Merge scheduling [merge-scheduling]
2020

21-
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.
21+
The merge scheduler controls the execution of merge operations when they are needed.
22+
Merges run on the dedicated `merge` thread pool.
23+
Smaller merges are prioritized over larger ones, across all shards on the node.
24+
Merges are disk IO throttled so that bursts, while merging activity is otherwise low, are smoothed out in order to not impact indexing throughput.
25+
There is no limit on the number of merges that can be enqueued for execution on the thread pool.
26+
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.
2227

23-
The merge scheduler supports the following *dynamic* setting:
28+
The available disk space is periodically monitored, such that no new merge tasks are scheduled for execution when the available disk space is low.
29+
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.
30+
31+
The merge scheduler supports the following *dynamic* settings:
2432

2533
`index.merge.scheduler.max_thread_count`
26-
: 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.
34+
: 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.
35+
36+
`indices.merge.disk.check_interval`
37+
: The time interval for checking the available disk space. Defaults to `5s`.
38+
39+
`indices.merge.disk.watermark.high`
40+
: Controls the disk usage watermark, which defaults to `95%`, beyond which no merge tasks can start execution.
41+
The disk usage tally includes the estimated temporary disk space still required by all the currently executing merge tasks.
42+
Any merge task scheduled *before* the limit is reached continues execution, even if the limit is exceeded while executing
43+
(merge tasks are not aborted).
44+
45+
`indices.merge.disk.watermark.high.max_headroom`
46+
: Controls the max headroom for the merge disk usage watermark, in case it is specified as percentage or ratio values.
47+
Defaults to `100GB` when `indices.merge.disk.watermark.high` is not explicitly set.
48+
This caps the amount of free disk space before merge scheduling is blocked.
2749

0 commit comments

Comments
 (0)