-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Add a _freeze / _unfreeze API
#35592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
106efb4
Add a `_freeze` / `_unfreeze` API
s1monw a0f3425
Merge branch 'master' into expose_freeze_index
s1monw 6579645
Update docs/reference/modules/threadpool.asciidoc
clintongormley da1a7e1
Update docs/reference/frozen-indices.asciidoc
clintongormley 9878477
Update docs/reference/frozen-indices.asciidoc
clintongormley 7e284c7
Update docs/reference/frozen-indices.asciidoc
clintongormley 72f6dbf
Update docs/reference/frozen-indices.asciidoc
clintongormley 095dc8f
Update docs/reference/frozen-indices.asciidoc
clintongormley 2ac89f0
Update docs/reference/frozen-indices.asciidoc
clintongormley 27f465c
Update docs/reference/frozen-indices.asciidoc
clintongormley 0a52d49
Update docs/reference/frozen-indices.asciidoc
clintongormley 433d407
Update docs/reference/frozen-indices.asciidoc
clintongormley 59db168
Update docs/reference/frozen-indices.asciidoc
clintongormley 2e33e30
Update docs/reference/frozen-indices.asciidoc
clintongormley 311884c
Update docs/reference/frozen-indices.asciidoc
clintongormley 71f6192
Update docs/reference/frozen-indices.asciidoc
clintongormley a4932e1
Update docs/reference/frozen-indices.asciidoc
clintongormley 3b4eef7
Update docs/reference/frozen-indices.asciidoc
clintongormley 5364a72
Update docs/reference/frozen-indices.asciidoc
clintongormley 0e5664f
Update docs/reference/frozen-indices.asciidoc
clintongormley b04e56c
Update docs/reference/frozen-indices.asciidoc
clintongormley 774369d
Update docs/reference/frozen-indices.asciidoc
clintongormley af5e748
Update docs/reference/frozen-indices.asciidoc
clintongormley 521e785
Update docs/reference/frozen-indices.asciidoc
clintongormley 0f915c0
Update docs/reference/frozen-indices.asciidoc
clintongormley 30be388
Update docs/reference/frozen-indices.asciidoc
clintongormley 471798b
Update docs/reference/frozen-indices.asciidoc
clintongormley 060f5a2
Update docs/reference/frozen-indices.asciidoc
clintongormley 4e04574
Update docs/reference/frozen-indices.asciidoc
clintongormley 6a144e1
Update docs/reference/frozen-indices.asciidoc
clintongormley e29c978
Update docs/reference/frozen-indices.asciidoc
clintongormley 8da5d6d
Merge branch 'master' into expose_freeze_index
s1monw 84806f6
[DOCS] Adds partintro and small edits
lcawl 0cc2613
[DOCS] Adds frozen indices page to Elasticsearch Reference
lcawl 3c1935c
[DOCS] Adds API reference pages for freeze and unfreeze
lcawl 2d0667f
[DOCS] Fixes gradle errors
lcawl c1736bb
Merge branch 'master' into expose_freeze_index
s1monw 801c462
move warning
s1monw 304adc6
address comments
s1monw f38f145
address feedback from @bleskes
s1monw 929f608
Merge branch 'master' into expose_freeze_index
s1monw 9648d71
make sure blocks survive cluster restarts
s1monw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| [role="xpack"] | ||
| [testenv="basic"] | ||
| [[frozen-indices]] | ||
| = Frozen Indices | ||
|
|
||
| Elasticsearch indices can require a significant amount of memory available in order to be open and searchable. Yet, not all indices need | ||
| to be writable at the same time and have different access patters over time. For example indices in the time-series or logging use-case | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| are unlikely to be queried once they age out but still need to be kept around for retention policy purposes. | ||
|
|
||
| In order to keep indices around for a longer time period but at the same time reducing their hardware requirements they can be transitioned | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| into a frozen state. Once an index is frozen, all it's transient shard memory aside of mappings and and necessary in-memory structures for | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| analysis is moved to persistent storage. This allows for a much higher disk to heap storage ratio on individual nodes. Once an index is | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| frozen their are read-only and require their data-structures required for query execution to be loaded on demand. A search request that hits | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| one or more shards from frozen indices will execute it's search through a throttling component that ensures that we never search more than | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `N` (`1` by default) searches concurrently. This protects nodes from exceeding the available memory due to incoming search requests. | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| In contrast to ordinary open indices, frozen indices are expected to execute slow and are not designed for high query load. Parallelism is | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| gained only on a per-node level and loading data-structures on demand is expected to be one or more orders of a magnitude slower than query | ||
| execution on a per shard level. Depending on the index and it's data executing a search on a frozen index is expected to be in the seconds | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| or even minutes range compared to milliseconds on a non-frozen index. | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| == Best Practices | ||
|
|
||
| Since frozen indices provide a much higher disk to heap ratio for the expense of latency it is recommended to allocate frozen indices on | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| dedicated nodes to prevent searches on frozen indices influencing traffic on low latency nodes. There is a significant overhead in loading | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| data-structures on demand which can cause page-faults and garbage collections further slowing down query execution. | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| Since indices that are eligible for freezing are likely to not change in the future disk space can be optimized. Many strategies are | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| outlined in <<tune-for-disk-usage>>. | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| == Freezing and unfreezing an index | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The freeze and unfreeze index APIs allow to freeze an index, and later on | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| unfreeze it. A frozen index has almost no overhead on the cluster (except | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| for maintaining its metadata in memory), and is blocked for write operations. | ||
| A frozen index can be unfrozen which will then go through the normal recovery process. | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| The REST endpoint is `/{index}/_freeze` and `/{index}/_unfreeze`. For | ||
| example: | ||
|
|
||
| [source,js] | ||
| -------------------------------------------------- | ||
| POST /my_index/_freeze | ||
| POST /my_index/_unfreeze | ||
| -------------------------------------------------- | ||
| // CONSOLE | ||
| // TEST[s/^/PUT my_index\n/] | ||
|
|
||
|
|
||
| [IMPORTANT] | ||
| ================================ | ||
| Freezing an index will close the index and reopen it within the same API call. This causes primaries to not be allocated for a short | ||
| amount of time and causes the cluster to go red until the primaries are allocated again. This limitation might be removed in the future | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ================================ | ||
|
|
||
| == Searching a frozen index | ||
|
|
||
| Frozen indices are throttled in order limit memory consumptions per node. The number of concurrently loaded frozen indices per node is | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| limited by the number of threads in the `search_throttled` <<modules-threadpool,threadpool>> which is `1` by default. At the same time, | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| search requests hitting may indices on a cluster due to concrete lists, expanded wildcards or a date pattern exclude frozen indices by | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| default to prevent accidental slowdowns when a frozen index is hit. To include frozen indices a search request must be executed with | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| `ignore_throttled=false`. | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| [source,js] | ||
| -------------------------------------------------- | ||
| GET /twitter/_search?q=user:kimchy&ignore_throttled=false | ||
| -------------------------------------------------- | ||
| // CONSOLE | ||
| // TEST[setup:twitter] | ||
|
|
||
| [IMPORTANT] | ||
| ================================ | ||
| While frozen indices are slow to search, they offer an efficient pre-filter phase. The request parameter `pre_filter_shard_size` specifies | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| a threshold that enforces a round-trip to filter search shards based on query rewriting if the number of shards the search | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| request expands to exceeds the threshold. This filter phase can limit the number of shards significantly if for instance a shard can not | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| match any documents based on it's rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint. | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| The default value for `pre_filter_shard_size` is `128` while for searching frozen indices it's recommended to set it to `1`. There is no | ||
s1monw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| significant overhead associated with this pre-filter phase. | ||
| ================================ | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.