DB time metrics

2024-11-06 03:13:28  Updated

This topic describes the DB time metrics for OceanBase Database tenants. OceanBase Cloud Platform (OCP) provides the following DB time metrics for tenants: db_cpu, non_idle_wait_time, background_db_cpu, and background_non_idle_wait_time. You can specify a statistical period to query the DB time metrics of a tenant in a single zone or on a single OBServer node.

db_cpu

Definition

The on-CPU time spent on executing commands in the database instance within the statistical period, excluding that spent on executing backend tasks.

Description

Metric Metric name Unit
db_cpu db_cpu μs

Calculation expression

sum(rate(ob_sysstat{stat_id="200002",@LABELS}[@INTERVAL])) by (@GBLABELS)

SQL statements for metric collection

  • OceanBase Database of a version earlier than V4.0:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id as tenant_id, stat_id, value from v$sysstat where stat_id IN (30066, 50003, 50021, 50022, 50030, 50039, 50040, 60031, 60057, 80023, 80025, 80026, 120002, 120005, 120006, 200001, 200002) and (con_id > 1000 or con_id = 1) UNION ALL select con_id, stat_id, value from v$sysstat where stat_id IN (80025,80026,80023) and con_id > 1 and con_id < 1001 UNION ALL select con_id as tenant_id, stat_id, value from v$sysstat where NAME = "memstore write lock wait timeout count" and (con_id > 1000 or con_id = 1)
    
  • OceanBase Database V4.0 or later:

    select /* MONITOR_AGENT */ tenant_id, stat_id, value from v$sysstat, DBA_OB_TENANTS where stat_id IN (30066, 50003, 50021, 50022, 50030, 50039, 50040, 60031, 60057, 60083, 80023, 80025, 80026, 120002, 120005, 120006, 200001, 200002) and (con_id > 1000 or con_id = 1) and DBA_OB_TENANTS.tenant_id = v$sysstat.con_id and DBA_OB_TENANTS.tenant_type<>'META' UNION ALL select con_id as tenant_id, stat_id, value from v$sysstat where stat_id IN (80025,80026,80023) and con_id > 1 and con_id < 1001
    

non_idle_wait_time

Definition

The non-idle wait time spent on executing commands in the database instance within the statistical period, excluding that spent on executing backend tasks.

Description

Metric Metric name Unit
non_idle_wait_time non_idle_wait_time μs

Calculation expression

sum(rate(ob_sysstat{stat_id="200010",@LABELS}[@INTERVAL])) by (@GBLABELS)

SQL statements for metric collection

  • OceanBase Database of a version earlier than V4.0:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (200010) and (con_id > 1000 or con_id = 1)
    
  • OceanBase Database V4.0 or later:

    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (200010) and (con_id > 1000 or con_id = 1)
    

background_db_cpu

Definition

The on-CPU time spent on executing database backend tasks within the statistical period.

Description

Metric Metric name Unit
background_db_cpu background_db_cpu μs

Calculation expression

sum(rate(ob_sysstat{stat_id="200006",@LABELS}[@INTERVAL])) by (@GBLABELS)

SQL statements for metric collection

  • OceanBase Database of a version earlier than V4.0:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (200006) and (con_id > 1000 or con_id = 1)
    
  • OceanBase Database V4.0 or later:

    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (200006) and (con_id > 1000 or con_id = 1)
    

background_non_idle_wait_time

Definition

The non-idle wait time spent on executing database backend tasks within the statistical period.

Description

Metric Metric name Unit
background_non_idle_wait_time background_non_idle_wait_time μs

Calculation expression

sum(rate(ob_sysstat{stat_id="200013",@LABELS}[@INTERVAL])) by (@GBLABELS)

SQL statements for metric collection

  • OceanBase Database of a version earlier than V4.0:

    select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (200013) and (con_id > 1000 or con_id = 1)
    
  • OceanBase Database V4.0 or later:

    select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (200013) and (con_id > 1000 or con_id = 1)
    

Contact Us