【OceanBase 诊断调优】—— ocp上针对OB租户CPU消耗计算逻辑

指标介绍

租户 CPU 使用量 * 100 / 租户 CPU 分配量。

指标参数说明

指标项 指标名称 单位
租户 CPU 消耗 ob_tenant_cpu_percent %

计算表达式

sum(rate(ob_sysstat{stat_id="140013",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(ob_sysstat{stat_id="140005",@LABELS}) by (@GBLABELS) / 100

参考sysstat监控项含义:

|---------|----------|------------------|----|---------|
| stat_id | name | 意义 | 单位 | 变量类型 |
| 140005 | max cpus | 每个租户的 CPU 分配量 | 个 | int64_t |
| 140013 | cpu time | 每个租户的所有线程累计cpu时间 | 微秒 | int64_t |

采集 SQL

  • OceanBase V4.0 以下版本:

    复制代码
    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from gv$sysstat where stat_id IN (140005, 140013) and (con_id > 1000 or con_id = 1)
  • OceanBase V4.0 及以上版本:

    复制代码
    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from gv$sysstat where stat_id IN (140005, 140013) and (con_id > 1000 or con_id = 1

QA

问:ocp查询租户的监控指标 租户 CPU 消耗查不到的原因是什么?

答:需同时满足observer内核版本和ocp版本的要求。

observer内核版本需满足如下及更新的版本:3.2.3 BP10、3.2.4 BP5、4.1 BP3、4.2

ocp版本需满足如下及更新的版本: 3.3.5 BP1、4.1.0 BP2、4.2.0

问:现在租户CPU的使用率,转储和合并的cpu消耗会体现在cpu time中吗?

答:在3.x版本下,转储和合并有自己的后台线程,不会体现在cpu time中。

在4.x版本下,转储和合并已经拆租户,会体现在cpu time中。

相关推荐
雅俗数据库2 天前
OCP实验 | 02-全链路诊断
oceanbase
雅俗数据库2 天前
OCP实验 | 05-运维管理
oceanbase
落日流年2 天前
欧拉操作系统部署OceanBase集群
运维·oceanbase
devilnumber2 天前
OceanBase 引擎 vs InnoDB 引擎 优缺点完整版对比
oceanbase
秋911 天前
OceanBase 全链路实战:从国产化选型到生产级部署(2026 终极指南)
oceanbase
GottdesKrieges11 天前
OceanBase恢复常见问题
java·数据库·oceanbase
GottdesKrieges11 天前
OceanBase备份常见问题
linux·网络·oceanbase
秋915 天前
OceanBase与GreatSQL哪个更适合高并发场景?
oceanbase
秋915 天前
OceanBase与GreatSQL在Java应用中的性能调优方法有哪些?
java·开发语言·oceanbase
摇曳的精灵19 天前
OceanBase学习
学习·oceanbase