【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中。

相关推荐
OceanBase数据库官方博客1 天前
OceanBase 4.4.2 LTS:Agent时代需要数据库超越存储角色
oceanbase
superonion06205 天前
【DB2】【Oceanbase】使用OMS将DB2迁移到Oceanbase测试
oceanbase·db
OceanBase数据库官方博客11 天前
OceanBase助力渤海银行:核心系统升级的实践与思考
oceanbase
OceanBase数据库官方博客11 天前
常州公积金采用OceanBase,三年稳定运行并实现智慧服务新范式
数据库·oceanbase
OceanBase数据库官方博客17 天前
现代数据架构:一套技术栈统一 TP、AP 与 AI
架构·oceanbase
粉墨白伶19 天前
【OceanBase】社区版三节点多副本容灾部署方案
oceanbase
OceanBase数据库官方博客19 天前
OceanBase seekdb-cli:专为 AI Agent 设计的数据库接口
数据库·人工智能·oceanbase
雅俗数据库23 天前
OCP实验 | 02-全链路诊断
oceanbase
雅俗数据库23 天前
OCP实验 | 05-运维管理
oceanbase
落日流年23 天前
欧拉操作系统部署OceanBase集群
运维·oceanbase