You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: troubleshoot/elasticsearch/high-cpu-usage.md
+52-10Lines changed: 52 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,6 @@ products:
19
19
20
20
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.
21
21
22
-
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).
23
-
24
22
::::{tip}
25
23
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).
26
24
::::
@@ -29,7 +27,7 @@ If you're using {{ech}}, you can use AutoOps to monitor your cluster. AutoOps si
29
27
30
28
## Diagnose high CPU usage [diagnose-high-cpu-usage]
31
29
32
-
**Check CPU usage**
30
+
### Check CPU usage[check-cpu-usage]
33
31
34
32
You can check the CPU usage per node using the [cat nodes API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-cat-nodes):
35
33
@@ -64,7 +62,7 @@ To track CPU usage over time, we recommend enabling monitoring:
64
62
::::::
65
63
66
64
:::::::
67
-
**Check hot threads**
65
+
### Check hot threads[check-hot-threads]
68
66
69
67
If a node has high CPU usage, use the [nodes hot threads API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-nodes-hot-threads) to check for resource-intensive threads running on the node.
70
68
@@ -79,17 +77,61 @@ This API returns a breakdown of any hot threads in plain text. High CPU usage fr
79
77
80
78
The following tips outline the most common causes of high CPU usage and their solutions.
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.
83
+
84
+
For optimal JVM performance, garbage collection should meet these criteria:
Excessive JVM garbage collection usually indicates high heap memory usage. Common potential reasons for increased heap memory usage include:
92
+
93
+
* Oversharding of indices
94
+
* Very large aggregation queries
95
+
* Excessively large bulk indexing requests
96
+
* Inefficient or incorrect mapping definitions
97
+
* Improper heap size configuration
98
+
* Misconfiguration of JVM new generation ratio (`-XX:NewRatio`)
99
+
100
+
### Hot spotting [high-cpu-usage-hot-spotting]
101
+
102
+
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. This is known as [hot spotting](hotspotting.md). Hot spotting commonly occurs when read or write applications don’t evenly distribute requests across nodes, or when indices receiving heavy write activity, such as indices in the hot tier, have their shards concentrated on just one or a few nodes.
103
+
104
+
For details on diagnosing and resolving these issues, refer to [](hotspotting.md).
105
+
106
+
### Oversharding [high-cpu-usage-oversharding]
107
+
108
+
Oversharding occurs when a cluster has too many shards, often times caused by shards being smaller than optimal. While {{es}} doesn’t have a strict minimum shard size, an excessive number of small shards can negatively impact performance. Each shard consumes cluster resources because {{es}} must maintain metadata and manage shard states across all nodes.
109
+
110
+
If you have too many small shards, you can address this by doing the following:
111
+
112
+
* Removing empty or unused indices.
113
+
* Deleting or closing indices containing outdated or unnecessary data.
114
+
* Reindexing smaller shards into fewer, larger shards to optimize cluster performance.
115
+
116
+
If your shards are sized correctly but you are still experiencing oversharding, creating a more aggressive [index lifecycle management strategy](/manage-data/lifecycle/index-lifecycle-management.md) or deleting old indices can help reduce the number of shards.
117
+
118
+
For more information, refer to [](/deploy-manage/production-guidance/optimize-performance/size-shards.md).
119
+
120
+
### Additional recommendations
121
+
122
+
To further reduce CPU load or mitigate temporary spikes in resource usage, consider these steps:
123
+
124
+
#### Scale your cluster [scale-your-cluster]
83
125
84
-
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.
126
+
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.
85
127
86
-
**Spread out bulk requests**
128
+
#### Spread out bulk requests[spread-out-bulk-requests]
87
129
88
-
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.
130
+
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.
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).
134
+
Regularly use the [task management API](https://www.elastic.co/docs/api/doc/elasticsearch/operation/operation-tasks-list) to identify and cancel searches that consume excessive CPU time.
0 commit comments