-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dashboard: add a monitoring page (#10771)
- Loading branch information
1 parent
228354e
commit 9f8ecba
Showing
3 changed files
with
180 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--- | ||
title: TiDB Dashboard 监控页面 | ||
summary: 介绍如何通过 TiDB Dashboard 监控页面查看 Performance Overview 面板,以及如何理解面板上的关键指标项。 | ||
--- | ||
|
||
# TiDB Dashboard 监控页面 | ||
|
||
从 TiDB Dashboard 监控页面,你可以查看性能分析和优化工具 Performance Overview 面板。借助 Performance Overview 面板,你可以高效地进行性能分析,确认用户响应时间的瓶颈是否在数据库中。如果数据库是整个系统的瓶颈,你可以通过数据库时间概览和 SQL 延迟的分解,定位数据库内部的瓶颈点。详情请参考 [TiDB 性能分析和优化方法](/performance-tuning-methods.md)。 | ||
|
||
## 访问页面 | ||
|
||
登录 Dashboard 后点击左侧导航的 **Monitoring** (监控)可以进入此功能页面: | ||
|
||
![Monitoring page](/media/dashboard/dashboard-monitoring.png) | ||
|
||
如果你使用 TiUP 部署 TiDB,你也可以在 Grafana 上查看 Performance Overview 面板。监控架构参见 [TiDB 监控框架概述](/tidb-monitoring-framework.md)。 | ||
|
||
![performance overview](/media/performance/grafana_performance_overview.png) | ||
|
||
## 面板监控指标详解 | ||
|
||
Performance Overview 面板按总分结构对 TiDB、TiKV 和 PD 的性能指标进行了编排组织,包含以下三部分内容: | ||
|
||
- 总的概览:数据库时间和 SQL 执行时间概览。通过颜色优化法,你可以快速识别数据库负载特征和性能瓶颈。 | ||
- 资源负载:关键指标和资源利用率,包含数据库 QPS、应用和数据库的连接信息和请求命令类型、数据库内部 TSO 和 KV 请求 OPS、TiDB 和 TiKV 的资源使用概况。 | ||
- 自上而下的延迟分解:Query 延迟和连接空闲时间对比、Query 延迟分解、execute 阶段 TSO 请求和 KV 请求的延迟、TiKV 内部写延迟的分解等。 | ||
|
||
以下为 Performance Overview 面板监控说明: | ||
|
||
### Database Time by SQL Type | ||
|
||
- database time: 每秒的总数据库时间 | ||
- sql_type: 每种 SQL 语句每秒消耗的数据库时间 | ||
|
||
### Database Time by SQL Phase | ||
|
||
- database time: 每秒的总数据库时间 | ||
- get token/parse/compile/execute: 4 个 SQL 处理阶段每秒消耗的数据库时间 | ||
|
||
execute 执行阶段为绿色,其他三个阶段偏红色系,如果非绿色的颜色占比明显,意味着在执行阶段之外数据库消耗了过多时间,需要进一步分析根源。 | ||
|
||
### SQL Execute Time Overview | ||
|
||
- execute time: execute 阶段每秒消耗的数据库时间 | ||
- tso_wait: execute 阶段每秒同步等待 TSO 的时间 | ||
- kv request type: execute 阶段每秒等待每种 KV 请求类型的时间,总的 KV request 等待时间可能超过 execute time,因为 KV request 是并发的。 | ||
|
||
绿色系标识代表常规的写 KV 请求(例如 Prewrite 和 Commit),蓝色系标识代表常规的读 KV 请求,其他色系标识需要注意的问题。例如,悲观锁加锁请求为红色,TSO 等待为深褐色。如果非蓝色系或者非绿色系占比明显,意味着执行阶段存在异常的瓶颈。例如,当发生严重锁冲突时,红色的悲观锁时间会占比明显;当负载中 TSO 等待的消耗时间过长时,深褐色会占比明显。 | ||
|
||
### QPS | ||
|
||
QPS:按 `SELECT`、`INSERT`、`UPDATE` 等类型统计所有 TiDB 实例上每秒执行的 SQL 语句数量 | ||
|
||
### CPS By Type | ||
|
||
CPS By Type:按照类型统计所有 TiDB 实例每秒处理的命令数(Command Per Second) | ||
|
||
### Queries Using Plan Cache OPS | ||
|
||
Queries Using Plan Cache OPS:所有 TiDB 实例每秒使用 Plan Cache 的查询数量 | ||
|
||
### KV/TSO Request OPS | ||
|
||
- kv request total: 所有 TiDB 实例每秒总的 KV 请求数量 | ||
- kv request by type: 按 `Get`、`Prewrite`、 `Commit` 等类型统计在所有 TiDB 实例每秒的请求数据 | ||
- tso - cmd:在所有 TiDB 实例每秒 tso cmd 的请求数量 | ||
- tso - request:在所有 TiDB 实例每秒 tso request 的请求数量 | ||
|
||
通常 tso - cmd 除以 tso - request 等于平均请求的 batch 大小。 | ||
|
||
### Connection Count | ||
|
||
- total:所有 TiDB 的连接数 | ||
- active connections:所有 TiDB 总的活跃连接数 | ||
- 各个 TiDB 的连接数 | ||
|
||
### TiDB CPU | ||
|
||
- avg:所有 TiDB 实例平均 CPU 利用率 | ||
- delta:所有 TiDB 实例中最大 CPU 利用率减去所有 TiDB 实例中最小 CPU 利用率 | ||
- max:所有 TiDB 实例中最大 CPU 利用率 | ||
|
||
### TiKV CPU/IO MBps | ||
|
||
- CPU-Avg:所有 TiKV 实例平均 CPU 利用率 | ||
- CPU-Delta:所有 TiKV 实例中最大 CPU 利用率减去所有 TiKV 实例中最小 CPU 利用率 | ||
- CPU-MAX:所有 TiKV 实例中最大 CPU 利用率 | ||
- IO-Avg:所有 TiKV 实例平均 MBps | ||
- IO-Delta:所有 TiKV 实例中最大 MBps 减去所有 TiKV 实例中最小 MBps | ||
- IO-MAX:所有 TiKV 实例中最大 MBps | ||
|
||
### Duration | ||
|
||
- Duration:执行时间解释 | ||
|
||
- 从客户端网络请求发送到 TiDB,到 TiDB 执行结束后返回给客户端的时间。一般情况下,客户端请求都是以 SQL 语句的形式发送,但也可以包含 `COM_PING`、`COM_SLEEP`、`COM_STMT_FETCH`、`COM_SEND_LONG_DATA` 之类的命令执行时间。 | ||
- 由于 TiDB 支持 Multi-Query,因此,客户端可以一次性发送多条 SQL 语句,如 `select 1; select 1; select 1;`。此时的执行时间是所有 SQL 语句执行完成的总时间。 | ||
|
||
- avg:所有请求命令的平均执行时间 | ||
- 99: 所有请求命令的 P99 执行时间 | ||
- avg by type:按 `SELECT`、`INSERT`、`UPDATE` 类型统计所有 TiDB 实例上所有请求命令的平均执行时间 | ||
|
||
### Connection Idle Duration | ||
|
||
Connection Idle Duration 指空闲连接的持续时间。 | ||
|
||
- avg-in-txn:处于事务中,空闲连接的平均持续时间 | ||
- avg-not-in-txn:没有处于事务中,空闲连接的平均持续时间 | ||
- 99-in-txn:处于事务中,空闲连接的 P99 持续时间 | ||
- 99-not-in-txn:没有处于事务中,空闲连接的 P99 持续时间 | ||
|
||
### Parse Duration、Compile Duration 和 Execute Duration | ||
|
||
- Parse Duration:SQL 语句解析耗时统计 | ||
- Compile Duration:将解析后的 SQL AST 编译成执行计划的耗时 | ||
- Execution Duration:执行 SQL 语句执行计划耗时 | ||
|
||
这三个时间指标均包含均所有 TiDB 实例的平均值和 P99 值。 | ||
|
||
### Avg TiDB KV Request Duration | ||
|
||
按 `Get`、`Prewrite`、 `Commit` 等类型统计在所有 TiDB 实例 KV 请求的平均执行时间。 | ||
|
||
### Avg TiKV GRPC Duration | ||
|
||
按 `get`、`kv_prewrite`、 `kv_commit` 等类型统计所有 TiKV 实例对 gRPC 请求的平均执行时间。 | ||
|
||
### PD TSO Wait/RPC Duration | ||
|
||
- wait - avg:所有 TiDB 实例等待从 PD 返回 TSO 的平均时间 | ||
- rpc - avg:所有 TiDB 实例从向 PD 发送获取 TSO 的请求到接收到 TSO 的平均耗时 | ||
- wait - 99:所有 TiDB 实例等待从 PD 返回 TSO 的 P99 时间 | ||
- rpc - 99:所有 TiDB 实例从向 PD 发送获取 TSO 的请求到接收到 TSO 的 P99 耗时 | ||
|
||
### Storage Async Write Duration、Store Duration 和 Apply Duration | ||
|
||
- Storage Async Write Duration:异步写所花费的时间 | ||
- Store Duration:异步写 Store 步骤所花费的时间 | ||
- Apply Duration:异步写 Apply 步骤所花费的时间 | ||
|
||
这三个时间指标都包含所有 TiKV 实例的平均值和 P99 值 | ||
|
||
平均 Storage async write duration = 平均 Store Duration + 平均 Apply Duration | ||
|
||
### Append Log Duration、Commit Log Duration 和 Apply Log Duration | ||
|
||
- Append Log Duration:Raft append 日志所花费的时间 | ||
- Commit Log Duration:Raft commit 日志所花费的时间 | ||
- Apply Log Duration:Raft apply 日志所花费的时间 | ||
|
||
这三个时间指标均包含所有 TiKV 实例的平均值和 P99 值。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters