---
metadata:
  - name: generator
    content: Diplodoc Platform v5.52.0
alternate:
  - https://ydb.tech/docs/en/troubleshooting/performance/ydb/tablets-moved.md?version=v25.4
  - https://ydb.tech/docs/ru/troubleshooting/performance/ydb/tablets-moved.md?version=v25.4
  - href: en/troubleshooting/performance/ydb/tablets-moved.md
    type: text/markdown
    title: Markdown version
  - href: ../../../llms.txt
    type: text/markdown
    title: llms.txt
sourcePath: en/core/troubleshooting/performance/ydb/tablets-moved.md
---
> **Documentation Index:** Fetch the complete configuration index at https://ydb.tech/docs/en/llms.txt

# Frequent tablet moves between nodes

YDB automatically balances the load by moving tablets from overloaded nodes to other nodes. This process is managed by [Hive](https://ydb.tech/docs/en/concepts/glossary.md?version=v25.4#hive). When Hive moves tablets, queries affecting those tablets might experience increased latencies while they wait for the tablet to get initialized on the new node.

YDB considers usage of the following hardware resources for balancing nodes:

* CPU
* Memory
* Network
* [Counter](*counter)

Autobalancing occurs in the following cases:

* **Imbalanced Hardware Resource Usage**

    YDB uses the Scatter metric to evaluate the balance of hardware resource usage. For more details on the Scatter metric's calculation logic and balancing triggers, see the [Resource Usage Imbalance](https://ydb.tech/docs/en/contributor/hive.md?version=v25.4#scatter) section.

* **Overloaded nodes (CPU and memory usage)**

    Hive initiates balancing in case of a significant load asymmetry (for example, > 90% on one node and < 70% on another). Learn more here: [Node Overload](https://ydb.tech/docs/en/contributor/hive.md?version=v25.4#emergency).

* **Uneven distribution of database objects**

    For tablets with no explicit resource consumption, Hive uses a fake **Counter** resource to ensure their even distribution. Balancing is triggered if this distribution becomes skewed. Learn more: [Even Distribution for a Specific Object](https://ydb.tech/docs/en/contributor/hive.md?version=v25.4#imbalance).


## Diagnostics

<!-- The include is added to allow partial overrides in overlays  -->
<!-- source: en/troubleshooting/performance/ydb/_includes/tablets-moved.md -->
1. See if the **Tablets moved by Hive** chart in the **[DB status](https://ydb.tech/docs/en/reference/observability/metrics/grafana-dashboards.md?version=v25.4#dbstatus)** Grafana dashboard shows any spikes.

    ![](_assets/tablets-moved.png)

        This chart displays the time-series data for the number of tablets moved per second.

1. See the Hive balancer stats.

    1. Open [Embedded UI](https://ydb.tech/docs/en/reference/embedded-ui/index.md?version=v25.4).

    1. Click **Developer UI** in the upper right corner of the Embedded UI.

    1. In the **Developer UI**, navigate to **Tablets > Hive > App**.

        See the balancer stats in the upper right corner.

        ![cpu balancer](_assets/cpu-balancer.jpg)

    1. Additionally, to see the recently moved tablets, click the **Balancer** button.

        The **Balancer** window will appear. The list of recently moved tablets is displayed in the **Latest tablet moves** section.
<!-- endsource: en/troubleshooting/performance/ydb/_includes/tablets-moved.md -->

## Recommendations

Adjust Hive balancer settings:

1. Open [Embedded UI](https://ydb.tech/docs/en/reference/embedded-ui/index.md?version=v25.4).

1. Click **Developer UI** in the upper right corner of the Embedded UI.

1. In the **Developer UI**, navigate to **Tablets > Hive > App**.

    ![](_assets/hive-app.png)

1. Click **Settings**.

1. To reduce the likelihood of overly frequent balancing, increase the following Hive balancer thresholds:

    #|
    || Parameter | Description | Default value ||
    || MinCounterScatterToBalance
    | The threshold for the counter scatter value. When this value is reached, Hive starts balancing the load.
    | 0.02 ||
    || MinCPUScatterToBalance
    | The threshold for the CPU scatter value. When this value is reached, Hive starts balancing the load.
    | 0.5 ||
    || MinMemoryScatterToBalance
    | The threshold for the memory scatter value. When this value is reached, Hive starts balancing the load.
    | 0.5 ||
    || MinNetworkScatterToBalance
    | The threshold for the network scatter value. When this value is reached, Hive starts balancing the load.
    | 0.5 ||
    || MaxNodeUsageToKick
    | The threshold for the node resource usage. When this value is reached, Hive starts emergency balancing.
    | 0.9 ||
    || ObjectImbalanceToBalance
    | The threshold for the database object imbalance metric.
    | 0.02 ||
    |#

    {% note info %}

    These parameters use relative values, where 1.0 represents 100% and effectively disables balancing. If the total hardware resource value can exceed 100%, adjust the ratio accordingly.

    {% endnote %}

[*counter]: Counter - a fake resource representing a count of tablets of a certain type on a node, used to ensure such tablets are distributed evenly across nodes.