CLUSTER_LOAD

The CLUSTER_LOAD cluster load table provides the current load information of the server where each instance of the TiDB cluster is located.

CLUSTER_LOAD - 图1

Note

This table is only applicable to TiDB Self-Hosted and not available on TiDB Cloud.

  1. USE information_schema;
  2. DESC cluster_load;
  1. +-------------+--------------+------+------+---------+-------+
  2. | Field | Type | Null | Key | Default | Extra |
  3. +-------------+--------------+------+------+---------+-------+
  4. | TYPE | varchar(64) | YES | | NULL | |
  5. | INSTANCE | varchar(64) | YES | | NULL | |
  6. | DEVICE_TYPE | varchar(64) | YES | | NULL | |
  7. | DEVICE_NAME | varchar(64) | YES | | NULL | |
  8. | NAME | varchar(256) | YES | | NULL | |
  9. | VALUE | varchar(128) | YES | | NULL | |
  10. +-------------+--------------+------+------+---------+-------+
  11. 6 rows in set (0.00 sec)

Field description:

  • TYPE: Corresponds to the TYPE field in the information_schema.cluster_info table. The optional values are tidb, pd, and tikv.
  • INSTANCE: Corresponds to the INSTANCE field in the information_schema.cluster_info cluster information table.
  • DEVICE_TYPE: Hardware type. Currently, you can query the cpu, memory, disk, and net types.
  • DEVICE_NAME: Hardware name. The value of DEVICE_NAME varies with DEVICE_TYPE.
    • cpu: The hardware name is cpu.
    • disk: The disk name.
    • net: The network card name.
    • memory: The hardware name is memory.
  • NAME: Different load types. For example, cpu has three load types: load1, load5, and load15, which respectively mean the average load of cpu within 1 minute, 5 minutes, and 15 minutes.
  • VALUE: The value of the hardware load. For example, 1min, 5min, and 15min respectively mean the average load of the hardware within 1 minute, 5 minutes, and 15 minutes.

The following example shows how to query the current load information of cpu using the CLUSTER_LOAD table:

  1. SELECT * FROM cluster_load WHERE device_type='cpu' AND device_name='cpu';
  1. +------+-----------------+-------------+-------------+--------+-------+
  2. | TYPE | INSTANCE | DEVICE_TYPE | DEVICE_NAME | NAME | VALUE |
  3. +------+-----------------+-------------+-------------+--------+-------+
  4. | tidb | 0.0.0.0:4000 | cpu | cpu | load1 | 0.13 |
  5. | tidb | 0.0.0.0:4000 | cpu | cpu | load5 | 0.25 |
  6. | tidb | 0.0.0.0:4000 | cpu | cpu | load15 | 0.31 |
  7. | pd | 127.0.0.1:2379 | cpu | cpu | load1 | 0.13 |
  8. | pd | 127.0.0.1:2379 | cpu | cpu | load5 | 0.25 |
  9. | pd | 127.0.0.1:2379 | cpu | cpu | load15 | 0.31 |
  10. | tikv | 127.0.0.1:20165 | cpu | cpu | load1 | 0.13 |
  11. | tikv | 127.0.0.1:20165 | cpu | cpu | load5 | 0.25 |
  12. | tikv | 127.0.0.1:20165 | cpu | cpu | load15 | 0.31 |
  13. +------+-----------------+-------------+-------------+--------+-------+
  14. 9 rows in set (1.50 sec)