Skip to content

Latest commit

 

History

History
68 lines (57 loc) · 3.37 KB

information-schema-cluster-load.md

File metadata and controls

68 lines (57 loc) · 3.37 KB
title summary aliases
CLUSTER_LOAD
Learn the `CLUSTER_LOAD` information_schema table.
/docs/dev/system-tables/system-table-cluster-load/
/docs/dev/reference/system-databases/cluster-load/
/tidb/dev/system-table-cluster-load/

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.

{{< copyable "sql" >}}

USE information_schema;
DESC cluster_load;
+-------------+--------------+------+------+---------+-------+
| Field       | Type         | Null | Key  | Default | Extra |
+-------------+--------------+------+------+---------+-------+
| TYPE        | varchar(64)  | YES  |      | NULL    |       |
| INSTANCE    | varchar(64)  | YES  |      | NULL    |       |
| DEVICE_TYPE | varchar(64)  | YES  |      | NULL    |       |
| DEVICE_NAME | varchar(64)  | YES  |      | NULL    |       |
| NAME        | varchar(256) | YES  |      | NULL    |       |
| VALUE       | varchar(128) | YES  |      | NULL    |       |
+-------------+--------------+------+------+---------+-------+
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:

{{< copyable "sql" >}}

SELECT * FROM cluster_load WHERE device_type='cpu' AND device_name='cpu';
+------+-----------------+-------------+-------------+--------+-------+
| TYPE | INSTANCE        | DEVICE_TYPE | DEVICE_NAME | NAME   | VALUE |
+------+-----------------+-------------+-------------+--------+-------+
| tidb | 0.0.0.0:4000    | cpu         | cpu         | load1  | 0.13  |
| tidb | 0.0.0.0:4000    | cpu         | cpu         | load5  | 0.25  |
| tidb | 0.0.0.0:4000    | cpu         | cpu         | load15 | 0.31  |
| pd   | 127.0.0.1:2379  | cpu         | cpu         | load1  | 0.13  |
| pd   | 127.0.0.1:2379  | cpu         | cpu         | load5  | 0.25  |
| pd   | 127.0.0.1:2379  | cpu         | cpu         | load15 | 0.31  |
| tikv | 127.0.0.1:20165 | cpu         | cpu         | load1  | 0.13  |
| tikv | 127.0.0.1:20165 | cpu         | cpu         | load5  | 0.25  |
| tikv | 127.0.0.1:20165 | cpu         | cpu         | load15 | 0.31  |
+------+-----------------+-------------+-------------+--------+-------+
9 rows in set (1.50 sec)