Core monitoring metrics and alerting practices

Updated at:

Navigating the vast number of database monitoring metrics can be overwhelming. You do not need to track every metric. By focusing on a few core metrics, you can quickly assess the overall health of your PolarDB-X instance. This document explains the most critical monitoring metrics for compute nodes (CNs), data nodes (DNs), CDC nodes, and columnar nodes, and offers guidance on their interpretation and optimization.

Solution architecture

Continuous health monitoring for databases in a production environment is crucial. Effective monitoring helps you predict resource bottlenecks, diagnose performance issues, and ensure the stability of your data services. A key challenge is to select critical metrics and set reasonable alert thresholds.

PolarDB-X adopts a distributed architecture with compute-storage separation. Understanding its core components is fundamental to effective monitoring. By configuring alert rules for the key components of PolarDB-X through the CloudMonitor service, you can automate the monitoring of system health.

  • Compute node (CN): A stateless SQL proxy layer responsible for SQL parsing, optimization, execution, and result merging. Its performance is primarily influenced by CPU and Java Virtual Machine (JVM) memory.

  • Data node (DN): A MySQL-based data storage unit responsible for data persistence and physical execution. Its performance is closely tied to CPU, memory (especially the buffer pool), and disk I/O.

  • Global Meta Service (GMS): Stores cluster metadata, such as table structures and partition information. Its stability is critical, but it typically does not require direct monitoring.

  • CDC node (Change Data Capture): Responsible for generating globally consistent binary logs (binlogs) for data subscription and synchronization. It only requires close attention when global binlog subscription is enabled.

  • Columnar node: Responsible for synchronizing row-store data into a columnar format in real time to accelerate analytical processing (AP) queries. Its core monitoring metric is the columnar synchronization latency.

Monitor compute resources (CNs)

CNs are the entry point for SQL requests. Their resource status directly affects the database's responsiveness and throughput.

CPU usage

  • Purpose: Monitor the computational load on CNs to prevent slow SQL execution or request backlogs caused by CPU resource exhaustion.

  • Metric analysis: In the PolarDB-X console, view the metric in the Monitoring and Alerting > Compute Monitoring > Instance > CPU chart. A consistently high CPU usage (for example, above 70%) typically indicates a compute resource bottleneck.

  • Recommended actions:

    • Scale out: When an overall increase in business queries per second (QPS) raises the total computational load, add more CNs to horizontally expand processing capacity.

    • Scale up: When a single complex query, such as a large report or a complex join, consumes significant CPU resources, upgrade the specifications of a single CN to enhance its computing power.

Memory and full GC

  • Purpose: Monitor the health of the JVM heap memory on CNs. Frequent Full Garbage Collections (GCs) are a clear sign of insufficient memory or a memory leak and can severely degrade performance.

  • Metric analysis:

    • Memory usage: In the PolarDB-X console, view the metric in the Monitoring and Alerting > Compute Monitoring > Cluster > Memory Capacity chart.

      CN memory is JVM heap memory, and its usage metric reflects the usage of the JVM's old generation. A regular sawtooth pattern in memory usage is a normal sign of Young GC. Due to the JVM's memory management, allocated heap memory is usually not immediately released to the operating system even when the workload decreases. Instead, it is retained for reuse. Therefore, it is normal for memory usage to remain at a high level (for example, 80% to 90%). The core metric for identifying a memory bottleneck is the Full GC time.

    • Full GC time: In the PolarDB-X console, view the metric in the Monitoring and Alerting > Compute Monitoring > Cluster > Full GC Time chart. If memory is sufficient, this metric should always be 0. Any non-zero value is a cause for concern. Frequent occurrences indicate a severe memory shortage.

  • Recommended actions:

    1. Identify memory-intensive SQL: Use the SQL Explorer feature to analyze and optimize SQL statements that consume large amounts of memory. Common types include:

      • Large-scale Batch Insert operations.

      • Aggregate operations that generate many intermediate results, such as GROUP BY or DISTINCT.

      • Cross-shard JOIN operations.

    2. Upgrade CNs: If memory pressure persists after SQL optimization, upgrade the memory specifications of the CNs.

    3. Monitor the Full GC time instead of memory usage.

Logical QPS and physical QPS

  • Purpose: Measure the database's distributed query efficiency and determine whether the partition key is used effectively.

  • Metric analysis:

    • Logical QPS: In the PolarDB-X console, view the metric in the Monitoring and Alerting > Compute Monitoring > Node > Logical TPS/Logical QPS/Physical QPS chart. This metric represents the number of SQL requests received by the CN layer.

    • Physical QPS: In the PolarDB-X console, view the metric in the Monitoring and Alerting > Compute Monitoring > Node > Logical TPS/Logical QPS/Physical QPS chart. This metric represents the number of SQL executions pushed down from the CN layer to the DN layer.

  • Recommended actions:

    • The ratio of physical QPS to logical QPS is a key indicator of database scalability. Ideally, this ratio should be close to 1:1, which indicates that most queries are precisely routed to a single data shard and that the partition key is used effectively.

    • If physical QPS is much higher than logical QPS (for example, if an instance has 16 shards and the ratio is close to 16:1), it indicates that many queries are executed without a partition key. This causes full-shard scans, which severely consume system resources and degrade performance.

    • Use the SQL Explorer feature to filter for SQL statements that have more than one physical execution. This helps you quickly locate queries that require optimization.

Note

To accurately reflect the business workload, QPS monitoring metrics automatically exclude non-business SQL statements, such as SELECT 1 (for connection pool health checks), SELECT @@... (for driver initialization), and transaction control statements (commit/rollback/begin).

Monitor storage resources (DNs)

DNs are responsible for data persistence. Their I/O, CPU, and memory form the foundation of database performance.

CPU usage

  • Purpose: Monitor the computational load on DNs. High CPU usage on a DN is often related to a large number of complex computations being pushed down or I/O bottlenecks.

  • Recommended actions:

    1. Optimize SQL: Check for slow queries or full table scans, and optimize your index design.

    2. Upgrade DNs: Upgrade the CPU and memory specifications of the DNs.

    3. Add DNs: Add more DNs to distribute the load. This operation triggers data redistribution and consumes resources; perform it during off-peak hours.

Memory

  • Purpose: Monitor the memory health of DNs, especially the efficiency of the buffer pool.

  • Metric analysis:

    • Memory usage: A DN's memory is primarily used for the buffer pool. This memory is allocated when the process starts. Therefore, it is normal and healthy for the memory usage to remain above 90% for extended periods.

    • Buffer pool read hit ratio: In the PolarDB-X console, view the metric in the Monitoring and Alerting > Storage Resource Monitoring > Node > Memory Buffer Pool chart. This metric is a core indicator of DN memory performance. All data reads and writes pass through the buffer pool. A higher hit ratio means fewer reads from disk. For online transaction processing (OLTP) workloads, a healthy level is above 98%. If the value falls below this level, performance degrades due to increased disk I/O.

IOPS usage

  • Purpose: Monitor disk I/O pressure, which is a common performance bottleneck.

  • Metric analysis: In the PolarDB-X console, view the metric in the Monitoring and Alerting > Storage Resource Monitoring > Node > IOPS Usage chart. IOPS usage is usually negatively correlated with the buffer pool read hit ratio. When the buffer pool cannot cache all hot data, disk I/O increases. If IOPS usage remains high, SQL latency increases significantly.

Monitor log and columnar resources (CDC and Columnar)

You need to monitor these components only when their related features are enabled.

  • CDC node: When you use global binlogs (for example, by subscribing through DTS or Canal), you need to monitor the CDC node. The core metrics to focus on are the node's CPU Usage and Processing Latency. High latency indicates that logs are not being processed promptly, which may require an upgrade of the CDC node.

  • Columnar node:

    • Latency: Columnar synchronization latency is a key metric. Typically, this latency is a few seconds. Latency that extends into minutes indicates a high load. If latency continues to increase, there is a risk of synchronization interruption.

    • CPU/Memory: A columnar node is a Java program. You can monitor its CPU and memory the same way you monitor a CN. If CPU usage remains high and latency increases, you need to upgrade the columnar node.

Configure alert rules

To ensure timely detection and resolution of issues, you must configure alert rules for the core metrics described in this topic.

  1. In the PolarDB-X console, go to the monitoring page for compute, storage, log, or columnar resources under Monitoring and Alerting, and then click Configure Alert Rule.

  2. Configure alert rules for each metric based on the suggestions in the following table. We recommend that you set the trigger condition to three consecutive detection periods to avoid false alarms from transient fluctuations.

  3. Finally, configure an alert contact group to ensure that you receive notifications when an alert is triggered.

Recommended alert configurations

Component

CloudMonitor product name

CloudMonitor metric name

Alert threshold

CN (compute node)

Cloud-Native Distributed Database PolarDB-X 2.0 Compute Node

PolarDBX_CN_CPUUsage

70%

DN (data node)

Cloud-Native Distributed Database PolarDB-X 2.0 Data Node

PolarDBX_DN_CPUUsage

70%

PolarDBX_DN_IOPSUsage

70%

PolarDBX_DN_DiskUsage

85%

CDC (CDC node)

Cloud-Native Distributed Database PolarDB-X 2.0 Compute Node

PolarDB-X CDC Dumper CPU Usage

70%

PolarDB-X CDC Dumper Delay

10 seconds

Columnar (columnar node)

PolarDB-X 2.0 Column Store Node

PolarDB-X Column Store Node Binlog Receive Latency

60 seconds

PolarDB-X Column Store Node CPU Utilization

70%

Note

You do not typically need to create alert rules for metrics that are not mentioned in the table. However, these metrics can still be valuable for troubleshooting scenarios.