TiDBTiDB Docs Dash 2024

Jan 9 - Jan 12 (UTC)
Join us to improve docs and win a prize!
Sign InTry Free

TiDB Cloud Built-in Metrics

TiDB Cloud collects and displays a full set of standard metrics of your cluster on the Metrics page. By viewing these metrics, you can easily identify performance issues and determine whether your current database deployment meets your requirements.

View the Metrics page

To view the metrics on the Metrics page, take the following steps:

  1. In the TiDB Cloud console, navigate to the Clusters page of your project.

  2. Click the name of the target cluster. The cluster overview page is displayed.

  3. Click Metrics in the left navigation pane.

Metrics retention policy

For TiDB Dedicated clusters and TiDB Serverless clusters, the metrics data is kept for 7 days.

Metrics for TiDB Dedicated clusters

The following sections illustrate the metrics on the Metrics page for TiDB Dedicated clusters.

Overview

Metric nameLabelsDescription
Database Time by SQL typesdatabase time, {SQL type}database time: total database time per second.
{SQL type}: database time consumed by SQL statements per second, which are collected by SQL types, such as SELECT, INSERT, and UPDATE.
Query Per Second{SQL type}The number of SQL statements executed per second in all TiDB instances, which are collected by SQL types, such as SELECT, INSERT, and UPDATE.
Query Durationavg-{SQL type}, 99-{SQL type}The duration from receiving a request from the client to TiDB until TiDB executes the request and returns the result to the client. In general, client requests are sent in the form of SQL statements; however, this duration can include the execution time of commands such as COM_PING, COM_SLEEP, COM_STMT_FETCH, and COM_SEND_LONG_DATA. TiDB supports Multi-Query, which means the client can send multiple SQL statements at one time, such as select 1; select 1; select 1;. In this case, the total execution time of this query includes the execution time of all SQL statements.
Failed QueriesAll, {Error type} @ {instance}The statistics of error types (such as syntax errors and primary key conflicts) according to the SQL statement execution errors per minute on each TiDB instance. It contains the module in which an error occurs and the error code.
Command Per SecondQuery, StmtExecute, and StmtPrepareThe number of commands processed by all TiDB instances per second based on command types.
Queries Using Plan Cache OPShit, misshit: the number of queries using plan cache per second in all TiDB instances.
miss: the number of queries missing plan cache per second in all TiDB instances.
Transaction Per Second{types}-{transaction model}The number of transactions executed per second.
Transaction Durationavg-{transaction model}, 99-{transaction model}The average or the 99th percentile duration of transactions.
Connection CountAll, active connectionAll: the number of connections to all TiDB instances.
Active connections: the number of active connections to all TiDB instances.
Disconnection Count{instance}-{result}The number of clients disconnected to each TiDB instance.

Advanced

Metric nameLabelsDescription
Average Idle Connection Durationavg-in-txn, avg-not-in-txnThe connection idle duration indicates the duration of a connection being idle.
avg-in-txn: The average connection idle duration when a connection is within a transaction.
avg-not-in-txn: The average connection idle duration when a connection is not within a transaction.
Get Token Durationavg, 99The average or the 99th percentile duration consumed in getting tokens of SQL statements.
Parse Durationavg, 99The average or the 99th percentile duration consumed in parsing SQL statements.
Compile Durationavg, 99The average or the 99th percentile duration consumed in compiling the parsed SQL AST to execution plans.
Execute Durationavg, 99The average or the 99th percentile duration consumed in executing execution plans of SQL statements.
Average TiDB KV Request Duration{Request Type}The average time consumed in executing KV requests in all TiDB instances based on request types, such as Get, Prewrite, and Commit.
Average TiKV gRPC Duration{Request Type}The average time consumed in executing gRPC requests in all TiKV instances based on request types, such as kv_get, kv_prewrite, and kv_commit.
Average / P99 PD TSO Wait/RPC Durationwait-avg/99, rpc-avg/99Wait: the average or the 99th percentile duration in waiting for PD to return TSO in all TiDB instances.
RPC: the average time or the 99th percentile of duration from sending TSO requests to PD to receiving TSO in all TiDB instances.
Average / P99 Storage Async Write Durationavg, 99The average or the 99th percentile duration consumed in asynchronous writing. Average storage async write duration = Average store duration + Average apply duration.
Average / P99 Store Durationavg, 99The average or the 99th percentile duration consumed in storing loop during asynchronous writing.
Average / P99 Apply Durationavg, 99The average or the 99th percentile duration consumed in applying loop during asynchronous writing.
Average / P99 Append Log Durationavg, 99The average or the 99th percentile duration consumed by Raft to append logs.
Average / P99 Commit Log Durationavg, 99The average or the 99th percentile duration consumed by Raft to commit logs.
Average / P99 Apply Log Durationavg, 99The average or the 99th percentile duration consumed by Raft to apply logs.

Server

Metric nameLabelsDescription
TiDB UptimenodeThe runtime of each TiDB node since last restart.
TiDB CPU UsagenodeThe CPU usage statistics of each TiDB node.
TiDB Memory UsagenodeThe memory usage statistics of each TiDB node.
TiKV UptimenodeThe runtime of each TiKV node since last restart.
TiKV CPU UsagenodeThe CPU usage statistics of each TiKV node.
TiKV Memory UsagenodeThe memory usage statistics of each TiKV node.
TiKV IO Bpsnode-write, node-readThe total input/output bytes per second of read and write in each TiKV node.
TiKV Storage UsagenodeThe storage usage statistics of each TiKV node.
TiFlash UptimenodeThe runtime of each TiFlash node since last restart.
TiFlash CPU UsagenodeThe CPU usage statistics of each TiFlash node.
TiFlash MemorynodeThe memory usage statistics of each TiFlash node.
TiFlash IO MBpsnode-write, node-readThe total bytes of read and write in each TiFlash node.
TiFlash Storage UsagenodeThe storage usage statistics of each TiFlash node.

Metrics for TiDB Serverless clusters

The Metrics page provides two tabs for metrics of TiDB Serverless clusters:

  • Cluster Status: displays the cluster-level main metrics.
  • Database Status: displays the database-level main metrics.

Cluster Status

The following table illustrates the cluster-level main metrics under the Cluster Status tab.

Metric nameLabelsDescription
Request UnitsRU per secondThe Request Unit (RU) is a unit of measurement used to track the resource consumption of a query or transaction. In addition to queries that you run, Request Units can be consumed by background activities, so when the QPS is 0, the Request Units per second might not be zero.
Used Storage SizeRow-based storage, Columnar storageThe size of the row store and the size of the column store.
Query Per SecondAll, {SQL type}The number of SQL statements executed per second, which are collected by SQL types, such as SELECT, INSERT, and UPDATE.
Average Query DurationAll, {SQL type}The duration from receiving a request from the client to the TiDB Serverless cluster until the cluster executes the request and returns the result to the client.
Failed QueryAllThe number of SQL statement execution errors per second.
Transaction Per SecondAllThe number of transactions executed per second.
Average Transaction DurationAllThe average execution duration of transactions.
Total ConnectionAllThe number of connections to the TiDB Serverless cluster.

Database Status

The following table illustrates the database-level main metrics under the Database Status tab.

Metric nameLabelsDescription
QPS Per DBAll, {Database name}The number of SQL statements executed per second on every database, which are collected by SQL types, such as SELECT, INSERT, and UPDATE.
Average Query Duration Per DBAll, {Database name}The duration from receiving a request from the client to a database until the database executes the request and returns the result to the client.
Failed Query Per DBAll, {Database name}The statistics of error types according to the SQL statement execution errors per second on every database.

FAQ

1. Why are some panes empty on this page?

If a pane does not provide any metrics, the possible reasons are as follows:

  • The workload of the corresponding cluster does not trigger this metric. For example, the failed query metric is always empty in the case of no failed queries.
  • The cluster version is low. You need to upgrade it to the latest version of TiDB to see these metrics.

If all these reasons are excluded, you can contact the PingCAP support team for troubleshooting.

2. Why might metrics be discontinuous in rare cases?

In some rare cases, metrics might be lost, such as when the metrics system experiences high pressure.

If you encounter this problem, you can contact PingCAP Support for troubleshooting.

Was this page helpful?

Download PDFRequest docs changesAsk questions on Discord
Playground
New
One-stop & interactive experience of TiDB's capabilities WITHOUT registration.
Products
TiDB
TiDB Dedicated
TiDB Serverless
Pricing
Get Demo
Get Started
© 2024 PingCAP. All Rights Reserved.
Privacy Policy.