Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resource-control: add dashboard panel #13907

Merged
merged 17 commits into from
May 24, 2023
1 change: 1 addition & 0 deletions TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -959,6 +959,7 @@
- [使用示例](/dashboard/dashboard-diagnostics-usage.md)
- [监控指标页面](/dashboard/dashboard-monitoring.md)
- [日志搜索页面](/dashboard/dashboard-log-search.md)
- [资源管控页面](/dashboard/dashboard-resource-control.md)
- 实例性能分析
- [手动分析页面](/dashboard/dashboard-profiling.md)
- [持续分析页面](/dashboard/continuous-profiling.md)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/continuous-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ summary: 了解如何持续地收集 TiDB、TiKV、PD 各个实例的性能数

你可以通过以下任一方式访问持续性能分析页面:

- 登录后,在左侧导航栏中点击**高级调试** (Advanced Debugging) > **实例性能分析** (Profiling Instances) > **持续分析** (Continuous Profiling)。
- 登录 Dashboard 后,在左侧导航栏中点击**高级调试** (Advanced Debugging) > **实例性能分析** (Profiling Instances) > **持续分析** (Continuous Profiling)。
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

![访问页面](/media/dashboard/dashboard-conprof-access.png)

Expand Down
2 changes: 1 addition & 1 deletion dashboard/dashboard-cluster-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ aliases: ['/docs-cn/dev/dashboard/dashboard-cluster-info/']

可以通过以下两种方法访问集群信息页面:

- 登录后,左侧导航条点击**集群信息** (Cluster Info):
- 登录 Dashboard 后,左侧导航条点击**集群信息** (Cluster Info):
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

![访问](/media/dashboard/dashboard-cluster-info-access-v650.png)

Expand Down
4 changes: 2 additions & 2 deletions dashboard/dashboard-diagnostics-access.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ aliases: ['/docs-cn/dev/dashboard/dashboard-diagnostics-access/']

可以通过以下两种方法访问集群诊断页面:

* 登录后,左侧导航条点击**集群诊断** (Cluster Diagnostics):
* 登录 Dashboard 后,左侧导航条点击**集群诊断** (Cluster Diagnostics):
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

![访问](/media/dashboard/dashboard-diagnostics-access-v650.png)

* 在浏览器中访问 [http://127.0.0.1:2379/dashboard/#/diagnose](http://127.0.0.1:2379/dashboard/#/diagnose)(将 `127.0.0.1:2379` 替换为任意实际 PD 地址和端口)。
* 在浏览器中访问 [http://127.0.0.1:2379/dashboard/#/diagnose](http://127.0.0.1:2379/dashboard/#/diagnose)(将 `127.0.0.1:2379` 替换为你的实际 PD 地址和端口)。

## 生成诊断报告

Expand Down
6 changes: 6 additions & 0 deletions dashboard/dashboard-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ TiDB Dashboard 在 GitHub 上[开源](https://github.com/pingcap-incubator/tidb-

参阅[日志搜索页面](/dashboard/dashboard-log-search.md)了解详情。

## 资源管控容量预估
HuSharp marked this conversation as resolved.
Show resolved Hide resolved

为[使用资源管控 (Resource Control) 实现资源隔离](/tidb-resource-control.md),集群管理员可以定义资源组 (Resource Group),通过资源组限定读写的配额。
HuSharp marked this conversation as resolved.
Show resolved Hide resolved

HuSharp marked this conversation as resolved.
Show resolved Hide resolved
在进行资源规划之前,你需要了解集群的整体容量。请参见 [TiDB Dashboard 资源管控页面](/dashboard/dashboard-resource-control.md)了解详情。
HuSharp marked this conversation as resolved.
Show resolved Hide resolved

## 收集分析各个组件的性能数据

高级调试功能:无需第三方工具,在线地对各个组件进行性能分析,剖析组件实例在分析时间段内执行的各种内部操作及比例。
Expand Down
2 changes: 1 addition & 1 deletion dashboard/dashboard-profiling.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ aliases: ['/docs-cn/dev/dashboard/dashboard-profiling/']

可以通过以下两种方法访问实例性能分析页面:

- 登录后,左侧导航条点击**高级调试** (Advanced Debugging) > **实例性能分析** (Profile Instances) > **手动分析** (Manual Profiling):
- 登录 Dashboard 后,左侧导航条点击**高级调试** (Advanced Debugging) > **实例性能分析** (Profile Instances) > **手动分析** (Manual Profiling):
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

![访问页面](/media/dashboard/dashboard-profiling-access.png)

Expand Down
75 changes: 75 additions & 0 deletions dashboard/dashboard-resource-control.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
title: TiDB Dashboard 资源管控页面
hfxsd marked this conversation as resolved.
Show resolved Hide resolved
summary: 在集群中搜索所有节点上的日志
HuSharp marked this conversation as resolved.
Show resolved Hide resolved
---

# TiDB Dashboard 资源管控页面

为[使用资源管控 (Resource Control) 实现资源隔离](/tidb-resource-control.md),集群管理员可以定义资源组 (Resource Group),通过资源组限定读写的配额。在进行资源规划之前,你需要了解集群的整体容量。该页面可以帮助你查看资源管控相关信息,以便预估集群容量,更好地进行资源配置。
HuSharp marked this conversation as resolved.
Show resolved Hide resolved

## 访问

可以通过以下两种方法访问资源管控页面:

* 登录 Dashboard 后,左侧导航条点击**资源管控** (**Resource Control**):
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

![访问](/media/dashboard/dashboard-resource-manager-access.png)
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

* 在浏览器中访问 <http://127.0.0.1:2379/dashboard/#/resource_manager>(将 `127.0.0.1:2379` 替换为你的实际 PD 地址和端口)。

## 资源管控页面详情

资源管控页面详情页面如下图所示:

![详情页面](/media/dashboard/dashboard-resource-manager-info.png)

整个页面分为三个部分:

- 配置:数据来自于 TiDB 的 [RESOURCE_GROUPS](/information-schema/information-schema-resource-groups.md#resource_groups) 表中所有资源组 (Resource Group) 的信息。参见 [RESOURCE_GROUPS](/information-schema/information-schema-resource-groups.md) 文档。

- 容量估算:在进行资源规划之前,你需要了解集群的整体容量。目前提供两种估算方式:

- [基于硬件部署估算容量](/sql-statements/sql-statement-calibrate-resource.md#基于硬件部署估算容量)
- [根据实际负载估算容量](/sql-statements/sql-statement-calibrate-resource.md#根据实际负载估算容量)

- 监控指标:通过观察面板上的指标,可以了解当前集群整体的资源消耗状态。

### 容量估算

在进行资源规划之前,你需要了解集群的整体容量。目前提供两种估算方式预估当前集群的 [`Request Unit (RU)`](/tidb-resource-control.md#什么是-request-unit-ru#什么是-request-unit-ru) 的容量:
HuSharp marked this conversation as resolved.
Show resolved Hide resolved

- [基于硬件部署估算容量](/sql-statements/sql-statement-calibrate-resource.md#基于硬件部署估算容量)

目前提供了以下不同的负载类型供选择:TPCC、OLTP_WRITE_ONLY、OLTP_READ_WRITE、OLTP_READ_ONLY。

![基于硬件部署估算容量](/media/dashboard/dashboard-resource-manager-calibrate-by-hardware.png)

用户资源分组总请求单元为当前除 `default` 用户外的 RU 总量。当小于容量估算值时,会进行提醒。

系统预定义的 `default` 资源组默认拥有无限用量。当所有用户都属于 `default` 资源组时,资源分配方式与关闭资源管控时相同。

- [根据实际负载估算容量](/sql-statements/sql-statement-calibrate-resource.md#根据实际负载估算容量)

![根据实际负载估算容量](/media/dashboard/dashboard-resource-manager-calibrate-by-workload.png)

可以选定时间范围:

- 当时间窗口范围 `DURATION` 不满足 10 分钟至 24 小时的条件,会导致报错提醒:`the duration of calibration is too short/long, which could lead to inaccurate output. Please make the duration between 10m0s and 24h0m0s`。

- 当时间窗口范围内的负载过低,会导致报错提醒:`The workload in selected time window is too low, with which TiDB is unable to reach a capacity estimation; please select another time window with higher workload, or calibrate resource by hardware instead`

可以通过监控指标中的 CPU Usage 来选定合适负载。

### 监控指标

可以选定时间范围,时区与前端用户所处时区相同。

- Total RU Consumed:实时统计的 [Request Unit (RU)](/tidb-resource-control.md#什么是-request-unit-ru) 总消耗量
HuSharp marked this conversation as resolved.
Show resolved Hide resolved
- RU Consumed by Resource Groups:以 Resource Group(资源组)为单位进行实时统计的 [Request Unit (RU)](/tidb-resource-control.md#什么是-request-unit-ru) 消耗数量
- TiDB
- CPU Quota: TiDB 最大 CPU 占用率
- CPU Usage: 所有 TiDB 实例 CPU 占用率
- TiKV
- CPU Quota: TiKV 最大 CPU 占用率
- CPU Usage: 所有 TiKV 实例 CPU 占用率
- IO MBps: 所有 TiKV 实例 MBps
4 changes: 2 additions & 2 deletions dashboard/dashboard-slow-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ aliases: ['/docs-cn/dev/dashboard/dashboard-slow-query/']

可以通过以下两种方法访问慢查询页面:

* 登录后,左侧导航条点击**慢查询** (**Slow Queries**):
* 登录 Dashboard 后,左侧导航条点击**慢查询** (**Slow Queries**):
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

![access 访问页面](/media/dashboard/dashboard-slow-queries-access-v620.png)

* 在浏览器中访问 <http://127.0.0.1:2379/dashboard/#/slow_query>(将 `127.0.0.1:2379` 替换为任意实际 PD 地址和端口)。
* 在浏览器中访问 <http://127.0.0.1:2379/dashboard/#/slow_query>(将 `127.0.0.1:2379` 替换为你的实际 PD 地址和端口)。

慢查询页面所展示的所有数据都来自于 TiDB 慢查询系统表及慢查询日志,参见[慢查询日志](/identify-slow-queries.md)文档了解详细情况。

Expand Down
2 changes: 1 addition & 1 deletion dashboard/dashboard-statement-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ aliases: ['/docs-cn/dev/dashboard/dashboard-statement-list/']

可以通过以下两种方法访问 SQL 语句分析页面:

- 登录后,左侧导航条点击 "**SQL 语句分析**" (SQL Statements)。
- 登录 Dashboard 后,左侧导航条点击 "**SQL 语句分析**" (SQL Statements)。
hfxsd marked this conversation as resolved.
Show resolved Hide resolved

![访问](/media/dashboard/dashboard-statement-access.png)

Expand Down
Oreoxmt marked this conversation as resolved.
Show resolved Hide resolved
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions tidb-resource-control.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Request Unit (RU) 是 TiDB 对 CPU、IO 等系统资源的统一抽象的单位,
- [根据实际负载估算容量](/sql-statements/sql-statement-calibrate-resource.md#根据实际负载估算容量)
- [基于硬件部署估算容量](/sql-statements/sql-statement-calibrate-resource.md#基于硬件部署估算容量)

详情请参考 [`CALIBRATE RESOURCE` 预估方式](/sql-statements/sql-statement-calibrate-resource.md#预估方式)。
可通过 [TiDB Dashboard 资源管控页面](/dashboard/dashboard-resource-control.md) 进行查看。详情请参考 [`CALIBRATE RESOURCE` 预估方式](/sql-statements/sql-statement-calibrate-resource.md#预估方式)。
HuSharp marked this conversation as resolved.
Show resolved Hide resolved

### 管理资源组

Expand Down Expand Up @@ -172,9 +172,11 @@ SELECT /*+ RESOURCE_GROUP(rg1) */ * FROM t limit 10;

## 监控与图表

TiDB 会定时采集资源管控的运行时信息,并在 Grafana 的 **Resource Control Dashboard** 中提供了相关指标的可视化图表。指标详情参见 [Resource Control 监控指标详解](/grafana-resource-control-dashboard.md)
TiDB 会定时采集资源管控的运行时信息,并在 Grafana 的 **Resource Control Dashboard** 中提供了相关指标的可视化图表,详见 [Resource Control 监控指标详解](/grafana-resource-control-dashboard.md)。

TiKV 中也记录了来自于不同资源组的请求 QPS,详见 [TiKV监控指标详解](/grafana-tikv-dashboard.md#grpc)
TiKV 中也记录了来自于不同资源组的请求 QPS,详见 [TiKV 监控指标详解](/grafana-tikv-dashboard.md#grpc)。

Dashboard 中可以查看当前 [RESOURCE_GROUPS](/information-schema/information-schema-resource-groups.md#resource_groups) 表。详见 [Dashboard 资源管控页面](/dashboard/dashboard-resource-control.md) 。
HuSharp marked this conversation as resolved.
Show resolved Hide resolved

## 工具兼容性

Expand Down