ocp_monitor 租户 sql占用过高

【 使用环境 】测试环境
【 OB or 其他组件 】OCP
【 使用版本 】 v4.2.2
【问题描述】ocp_monitor sql占用CPU过高. 有什么参数可以降低这个sql的占用/或者执行频率吗 ?

  1. 被管理集群为 observer 4.3.5.5, 1-1-1 集群, 8C 64G .
  2. ocp_monitor 租户配置为 4C 12G
  3. ocp_monitor TOP 1 SQL
select
  /*+ 
          index(ob_hist_plan_cache_plan_logic_explain idx_ob_db_id_sql_id_plan_union_hash)
           
           
                  query_timeout(30000000) read_consistency(weak)
               
       
          */
  collect_time as collectTimeUs,
  ob_cluster_id as obClusterId,
  cluster_name as clusterName,
  ob_tenant_id as obTenantId,
  ob_server_id as obServerId,
  plan_id as planId,
  first_load_time as firstLoadTimeUs,
  id as id,
  operator as operator,
  IF(object_type = ?, object_alias, ?) as objectName,
  IF(object_type = ?, object_name, ?) as objectAlias,
  cardinality as rows,
  cost as cost,
  real_cardinality as realRows,
  real_cost as realCost,
  io_cost as ioCost,
  cpu_cost as cpuCost,
  projection as projection,
  filter_predicates as filterPredicates,
  startup_predicates as startupPredicates,
  rowset as rowset,
  access_predicates as accessPredicates,
  partition_start as partitionStart,
  special_predicates as specialPredicates,
  depth as depth,
  other_tag as otherTag,
  remarks as remarks,
  other_xml as otherXml,
  optimizer as optimizer,
  other as other,
  gmt_create as create_time
from
  ob_hist_plan_cache_plan_logic_explain
where
  collect_time >= ?
  and collect_time < ?
  and ob_cluster_id = ?
  and cluster_name = ?
  and ob_tenant_id = ?
  and ob_server_id = ?
  and plan_union_hash = ?

【附件及日志】

【备注】基于 LLM 和开源文档 RAG 的论坛小助手已开放测试,在发帖时输入 [@论坛小助手] 即可召唤小助手,欢迎试用!

5 个赞

感谢您提供的详细信息。对于您遇到的 SQL 占用 CPU 过高的问题,我们推荐使用 obdiag 工具来进行日志采集和根因分析。这将帮助我们更好地理解问题的具体原因。

推荐操作

根因分析场景: [SQL性能问题]

根因分析命令:

obdiag rca run --scene=observer.perf_sql --env "{db_connect='-h<your_host> -P<your_port> -u<your_username>@<your_tenant> -p<your_password> -D<your_database>', trace_id='<your_trace_id>'}"

请替换 <your_host>, <your_port>, <your_username>, <your_tenant>, <your_password>, <your_database>, 和 <your_trace_id> 为您实际使用的值。这条命令将基于提供的环境变量来执行针对 SQL 性能问题的根因分析。

日志采集场景: [CPU高]

日志采集命令:

obdiag gather scene run --scene=observer.cpu_high

该命令用于收集与高 CPU 使用率相关的系统日志及诊断信息。

下一步行动

请您运行上述命令并将生成的日志压缩包提供给我们进行进一步分析。同时,为了更准确地定位问题,请您回答以下几个问题:

  1. 您提到的特定 SQL 语句是否在固定的时间段内频繁执行?如果是的话,请告知具体的执行频率(例如每分钟、每小时等)。
  2. 该 SQL 执行时,是否有其他大负载的操作正在运行?
  3. 是否对 ocp_monitor 租户或其他租户做过任何配置变更或调整过参数设置?
  4. 能否提供更多关于上传截图和日志文件的详情?特别是它们所展示的异常情况。
  5. 系统中是否有安装监控工具或启用了 OceanBase 的自带监控功能?如果有,能否分享这段时间内的监控数据?

通过这些额外的信息,我们可以更快地识别出导致高 CPU 使用率的根本原因,并给出相应的解决方案建议。

附上敏捷诊断工具 obdiag 使用帮助链接

1 个赞

我们也经常飙高,受不了就做个SQL限流

1 个赞

很多内部慢sql

1 个赞

内部慢sql?

1 个赞

太棒啦

哈哈哈,好的 我也给限流了看看

好的, 感谢回复. 我调整了慢sql 记录时间, 观察看看