Skip to content

Commit 1aed359

Browse files
committed
updated doc
1 parent 3d2815f commit 1aed359

File tree

1 file changed

+43
-8
lines changed

1 file changed

+43
-8
lines changed

troubleshoot/elasticsearch/high-cpu-usage.md

+43-8
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ mapped_pages:
1010

1111
If a thread pool is depleted, {{es}} will [reject requests](rejected-requests.md) related to the thread pool. For example, if the `search` thread pool is depleted, {{es}} will reject search requests until more threads are available.
1212

13-
You might experience high CPU usage if a [data tier](../../manage-data/lifecycle/data-tiers.md), and therefore the nodes assigned to that tier, is experiencing more traffic than other tiers. This imbalance in resource utilization is also known as [hot spotting](hotspotting.md).
14-
1513
::::{tip}
1614
If you're using {{ech}}, you can use AutoOps to monitor your cluster. AutoOps significantly simplifies cluster management with performance recommendations, resource utilization visibility, and real-time issue detection with resolution paths. For more information, refer to [](/deploy-manage/monitor/autoops.md).
1715
::::
@@ -70,17 +68,54 @@ This API returns a breakdown of any hot threads in plain text. High CPU usage fr
7068

7169
The following tips outline the most common causes of high CPU usage and their solutions.
7270

73-
**Scale your cluster**
71+
**Check JVM garbage collection**
72+
73+
High CPU usage is often caused by excessive JVM garbage collection (GC) activity. This excessive GC typically arises from configuration problems or inefficient queries causing increased heap memory usage.
74+
75+
For optimal JVM performance, garbage collection should meet these criteria:
76+
77+
1. Young GC completes quickly (ideally within 50 ms).
78+
2. Young GC does not occur too frequently (approximately once every 10 seconds).
79+
3. Old GC completes quickly (ideally within 1 second).
80+
4. Old GC does not occur too frequently (once every 10 minutes or less frequently).
81+
82+
Excessive JVM garbage collection usually indicates high heap memory usage. Common potential reasons for increased heap memory usage include:
83+
84+
* Oversharding of indices
85+
* Very large aggregation queries
86+
* Excessively large bulk indexing requests
87+
* Inefficient or incorrect mapping definitions
88+
* Improper heap size configuration
89+
* Misconfiguration of JVM new generation ratio (-XX:NewRatio)
90+
91+
**Hot spotting**
92+
93+
You might experience high CPU usage on specific data nodes or an entire [data tier](/manage-data/lifecycle/data-tiers.md) if traffic isn’t evenly distributed—a scenario known as [hot spotting](hotspotting.md). This commonly occurs when read or write applications don’t properly balance requests across nodes, or when indices receiving heavy write activity (like hot-tier indices) have their shards concentrated on just one or a few nodes.
94+
95+
For details on diagnosing and resolving these issues, see [hot spotting](hotspotting.md).
96+
97+
**Oversharding**
98+
99+
If your Elasticsearch cluster contains a large number of shards, you might be facing an oversharding issue.
100+
101+
Oversharding occurs when there are too many shards, causing each shard to be smaller than optimal. While Elasticsearch doesn’t have a strict minimum shard size, an excessive number of small shards can negatively impact performance. Each shard consumes cluster resources since Elasticsearch must maintain metadata and manage shard states across all nodes.
102+
103+
If you have too many small shards, you can address this by:
74104

75-
Heavy indexing and search loads can deplete smaller thread pools. To better handle heavy workloads, add more nodes to your cluster or upgrade your existing nodes to increase capacity.
105+
* Removing empty or unused indices.
106+
* Deleting or closing indices containing outdated or unnecessary data.
107+
* Reindexing smaller shards into fewer, larger shards to optimize cluster performance.
76108

77-
**Spread out bulk requests**
109+
See [Size your shards](/deploy-manage/production-guidance/optimize-performance/size-shards.md) for more information.
78110

79-
While more efficient than individual requests, large [bulk indexing](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk) or [multi-search](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-msearch) requests still require CPU resources. If possible, submit smaller requests and allow more time between them.
111+
### Additional recommendations
80112

81-
**Cancel long-running searches**
113+
To further reduce CPU load or mitigate temporary spikes in resource usage, consider these steps:
82114

83-
Long-running searches can block threads in the `search` thread pool. To check for these searches, use the [task management API](https://www.elastic.co/docs/api/doc/elasticsearch/group/endpoint-tasks).
115+
* Scale your cluster: Heavy indexing and search loads can deplete smaller thread pools.Add nodes or upgrade existing ones to handle increased indexing and search loads more effectively.
116+
* Spread out bulk requests: Submit smaller [bulk indexing](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-bulk-1) or multi-search requests and space them out to avoid overwhelming thread pools.
117+
* Cancel long-running searches: Regularly use the task management API to identify and cancel searches that consume excessive CPU time. To check
118+
for these searches, use the [task management API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-tasks-list).
84119

85120
```console
86121
GET _tasks?actions=*search&detailed

0 commit comments

Comments
 (0)