Circuit breaker settings

edit

Elasticsearch contains multiple circuit breakers used to prevent operations from causing an OutOfMemoryError. Each breaker specifies a limit for how much memory it can use. Additionally, there is a parent-level breaker that specifies the total amount of memory that can be used across all breakers.

Except where noted otherwise, these settings can be dynamically updated on a live cluster with the cluster-update-settings API.

For information about circuit breaker errors, see Circuit breaker errors.

Parent circuit breaker

edit

The parent-level breaker can be configured with the following settings:

indices.breaker.total.use_real_memory
(Static) Determines whether the parent breaker should take real memory usage into account (true) or only consider the amount that is reserved by child circuit breakers (false). Defaults to true.
indices.breaker.total.limit logo cloud
(Dynamic) Starting limit for overall parent breaker. Defaults to 70% of JVM heap if indices.breaker.total.use_real_memory is false. If indices.breaker.total.use_real_memory is true, defaults to 95% of the JVM heap.

Field data circuit breaker

edit

The field data circuit breaker estimates the heap memory required to load a field into the field data cache. If loading the field would cause the cache to exceed a predefined memory limit, the circuit breaker stops the operation and returns an error.

indices.breaker.fielddata.limit logo cloud
(Dynamic) Limit for fielddata breaker. Defaults to 40% of JVM heap.
indices.breaker.fielddata.overhead logo cloud
(Dynamic) A constant that all field data estimations are multiplied with to determine a final estimation. Defaults to 1.03.

Request circuit breaker

edit

The request circuit breaker allows Elasticsearch to prevent per-request data structures (for example, memory used for calculating aggregations during a request) from exceeding a certain amount of memory.

indices.breaker.request.limit logo cloud
(Dynamic) Limit for request breaker, defaults to 60% of JVM heap.
indices.breaker.request.overhead logo cloud
(Dynamic) A constant that all request estimations are multiplied with to determine a final estimation. Defaults to 1.

In flight requests circuit breaker

edit

The in flight requests circuit breaker allows Elasticsearch to limit the memory usage of all currently active incoming requests on transport or HTTP level from exceeding a certain amount of memory on a node. The memory usage is based on the content length of the request itself. This circuit breaker also considers that memory is not only needed for representing the raw request but also as a structured object which is reflected by default overhead.

network.breaker.inflight_requests.limit
(Dynamic) Limit for in flight requests breaker, defaults to 100% of JVM heap. This means that it is bound by the limit configured for the parent circuit breaker.
network.breaker.inflight_requests.overhead
(Dynamic) A constant that all in flight requests estimations are multiplied with to determine a final estimation. Defaults to 2.

Accounting requests circuit breaker

edit

The accounting circuit breaker allows Elasticsearch to limit the memory usage of things held in memory that are not released when a request is completed. This includes things like the Lucene segment memory.

indices.breaker.accounting.limit
(Dynamic) Limit for accounting breaker, defaults to 100% of JVM heap. This means that it is bound by the limit configured for the parent circuit breaker.
indices.breaker.accounting.overhead
(Dynamic) A constant that all accounting estimations are multiplied with to determine a final estimation. Defaults to 1

Script compilation circuit breaker

edit

Slightly different than the previous memory-based circuit breaker, the script compilation circuit breaker limits the number of inline script compilations within a period of time.

See the "prefer-parameters" section of the scripting documentation for more information.

script.max_compilations_rate
(Dynamic) Limit for the number of unique dynamic scripts within a certain interval that are allowed to be compiled. Defaults to 150/5m, meaning 150 every 5 minutes.

If the cluster regularly hits the given max_compilation_rate, it’s possible the script cache is undersized, use Nodes Stats to inspect the number of recent cache evictions, script.cache_evictions_history and compilations script.compilations_history. If there are a large number of recent cache evictions or compilations, the script cache may be undersized, consider doubling the size of the script cache via the setting script.cache.max_size.

Regex circuit breaker

edit

Poorly written regular expressions can degrade cluster stability and performance. The regex circuit breaker limits the use and complexity of regex in Painless scripts.

script.painless.regex.enabled

(Static) Enables regex in Painless scripts. Accepts:

limited (Default)
Enables regex but limits complexity using the script.painless.regex.limit-factor cluster setting.
true
Enables regex with no complexity limits. Disables the regex circuit breaker.
false
Disables regex. Any Painless script containing a regular expression returns an error.
script.painless.regex.limit-factor

(Static) Limits the number of characters a regular expression in a Painless script can consider. Elasticsearch calculates this limit by multiplying the setting value by the script input’s character length.

For example, the input foobarbaz has a character length of 9. If script.painless.regex.limit-factor is 6, a regular expression on foobarbaz can consider up to 54 (9 * 6) characters. If the expression exceeds this limit, it triggers the regex circuit breaker and returns an error.

Elasticsearch only applies this limit if script.painless.regex.enabled is limited.