Elasticsearch Breaker



Elasticsearch Breaker

Opster Team

July 2020, Version: 1.7-8.0


Before you begin reading the explanation below, try running the free ES Health Check-Up get actionable recommendations that can improve Elasticsearch performance and prevent serious incidents. Just 2 minutes to complete and you can check your threadpools, memory, snapshots and many more

Breaker in Elasticsearch


Elasticsearch has the concept of circuit breakers to deal with OutOfMemory errors that cause nodes to crash. When a request reaches Elasticsearch nodes, the circuit breakers first estimate the amount of memory needed to load the required data. They then compare the estimated size with the configured heap size limit. If the estimated size is greater than the heap size, the query is terminated and an exception is thrown to avoid the node loading more than the available heap size.

What it is used for

Elasticsearch has several circuit breakers available such as fielddata, requests, network, indices and script compilation. Each breaker is used to limit the memory an operation can use. In addition, Elasticsearch has a parent circuit breaker which is used to limit the combined memory used by all the other circuit breakers.

Examples

Increasing circuit breaker size for fielddata limit – The default limit for fielddata breakers is 40%. The following command can be used to increase it to 60%:

PUT /_cluster/settings
{
  "persistent": {
    "indices.breaker.fielddata.limit": "60%"
  }
}
Notes
  • Each breaker ships with default limits and their limits can be modified as well. But this is an expert setting and you should understand the pitfalls carefully before changing the limits, otherwise the node may start OOM exceptions.
  • Sometimes it is better to fail a query instead of getting OOM, because when OOM appears JVM becomes unresponsive.
  • It is important to keep indices.breaker.request.limit lower than indices.breaker.total.limit so that request circuit breakers trip before the total circuit breaker.
Common Problems
  • The most common error  resulting from circuit breakers is “data too large” with 429 status code. The application should be ready to handle such exceptions.
  • If the application starts throwing exceptions because of circuit breaker limits, it is important to review the queries and memory requirements. In most cases, a scaling is required by adding more resources to the cluster.

Related log errors to this ES concept


New used memory for data of would be larger than configured breaker: ; breaking
Updated breaker settings field data:
Updated breaker settings for accounting requests:
Updated breaker settings request:
Updated breaker settings for in-flight requests:
New used memory from field would be larger than configured breaker: ; breaking
Updated breaker settings fielddata:
Updated breaker settings parent:
Updating settings parent . fielddata . request
Cannot determine current memory usage due to JDK-8207200.

About Opster

Opster detects, prevents, optimizes and automates everything needed to run mission-critical Elasticsearch

Find Configuration Errors

Analyze Now