# Scheduling Process

+ Store: `basic information`, `capacity`, `available space`, `QPS`, etc
+ Region: `range`, `replica distribution`, `replica status`, `data volume`, `QPS`, etc
+ **`balance-leader-scheduler`**: Balances the distribution of leaders
+ **`balance-region-scheduler`**: Balances the distribution of peers
+ **`hot-region-scheduler`**: Balances the distribution of hot `Region`
+ **`evict-leader-{store-id}`**: Evicts all leaders of a node (often used for rolling upgrade)

![`smart`](./student-guide/diagram/TiKVSchedulingStpes_aa_001_20221014.png)
-----------------------------------------------------------------
The scheduling process can be broadly divided into 3 parts:

1. Information collection: TiKV nodes periodically report store and region information to PD
  - Store: basic information, capacity, remaining space, reads and writes traffic, etc.
  - Region: range, replica distribution, replica status, data volume, reads and writes traffic, etc.

2. Build schedules: Different schedulers generate operators to be executed based on their own logic and requirements, considering limits and constraints
  - balance-leader-scheduler: Maintains balance of leaders of different nodes
  - balance-region-scheduler: Keeps peers balanced across different nodes
  - Hot-region-scheduler: Maintains balanced reads and writes hotspot regions Region different nodes
  - evict-leader-{store-id}: Expel all leaders of a node

3. Execute the schedule: The generated Operator enters the wait queue. The PD removes the Operator from the wait queue according to the configuration and sends each Operator Step to the Leader of the corresponding region.
