﻿---
title: Gc Ratio Unbalanced
description: Describes what AutoOps detects and surfaces with the Gc Ratio Unbalanced insight: Garbage collection balance between young and old heap regions is off on the affected node.
url: https://docs-v3-preview.elastic.dev/elastic/autoops-insights/tree/main/elasticsearch/gc_ratio_unbalanced
products:
  - Elastic Cloud Enterprise
  - Elastic Cloud Hosted
  - Elastic Cloud on Kubernetes
  - Elasticsearch
applies_to:
  - Elastic Cloud Hosted: Generally available
  - Elastic Cloud on Kubernetes: Generally available
  - Elastic Cloud Enterprise: Generally available
  - Self-managed Elastic deployments: Generally available
---

# Gc Ratio Unbalanced
Garbage collection balance between young and old heap regions is off on the affected node. The node might pause more often while old-generation collections run, hurting search and indexing responsiveness.
<note>
  For a complete list of insights, refer to [AutoOps insights](https://docs-v3-preview.elastic.dev/elastic/autoops-insights/tree/main/elasticsearch).
</note>


## Insight details


| Field     | Value                       |
|-----------|-----------------------------|
| Component | Elasticsearch               |
| Severity  | Medium                      |
| Scope     | Node                        |
| Domains   | performance, cpu, stability |


## Customization settings

You can customize these settings to adjust when AutoOps detects this event and presents the insight. Refer to [AutoOps event settings](https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/deploy-manage/monitor/autoops/ec-autoops-event-settings) for details.
The default customization settings are:

| Setting                                      | Type       | Default |
|----------------------------------------------|------------|---------|
| Delta between old and young GC in percentage | Percentage | 50      |


## Example: What you might see in AutoOps

The following is an example of what you might see when this insight is triggered. Real insights use live data and links from your deployment or cluster.

### The GC ratio between old and young GC sections is not balanced on the following node/s: `es-data-01`


#### What was detected

The affected node/s are: `es-data-01` and `es-data-02` High search activity indices:`logs-prod-000045` High indexing activity indices:`logs-prod-000045`.

#### Recommendations

<note>
  AutoOps shows different recommendations depending on how their conditions match your deployment or cluster.
</note>

<dropdown title="Balance old and young GC">
  **Condition**: Shown when the gc-old / gc-new ratio diverges by more than 50%.Set `-XX:NewRatio=2` in your JVM options file to tune the ratio between old and young GC, then perform a rolling restart of affected nodes.
</dropdown>

<dropdown title="Increase parallel GC threads">
  **Condition**: Shown when gC load is unbalanced across nodes.Set `-XX:ParallelGCThreads` to the number of available processors on the data node, then restart the node.
</dropdown>

<dropdown title="Enable and review search slow logs">
  **Condition**: Shown when gC load is unbalanced across nodes.Enable search slow logs with the action below, then review the slow log to find expensive queries. See [Slow logs](https://docs-v3-preview.elastic.dev/elastic/docs-content/tree/main/deploy-manage/monitor/logging-configuration/slow-logs) for configuration details.
  ```json

  {
    "index.search.slowlog.threshold.query.warn": "10s",
    "index.search.slowlog.threshold.query.info": "5s",
    "index.search.slowlog.threshold.query.debug": "2s",
    "index.search.slowlog.threshold.query.trace": "500ms",
    "index.search.slowlog.threshold.fetch.warn": "1s",
    "index.search.slowlog.threshold.fetch.info": "800ms",
    "index.search.slowlog.threshold.fetch.debug": "500ms",
    "index.search.slowlog.threshold.fetch.trace": "200ms"
  }
  ```

  <note>
    Requires the `manage` index privilege. Requires Elasticsearch 8.0.0 or later. This action changes cluster or index configuration.
  </note>
</dropdown>


#### Background and impact

Impact: The node can hang (not respond) more frequently as it waits for old GC to complete.
The garbage collection process frees up memory in the cluster. Normally the young GC process occurs more frequently than the old GC process.
It is recommended to make small step changes in this setting and observe performance. A good default is usually 3. It is advised to tune -XX:NewRatio, and increase the ratio toward old, for better GC resource utilization. The system detected that old is loading more than young GC.