PolarDB-X provides a variety of monitoring and auditing features to help you observe the performance metrics and status of databases in real time.
Monitoring and alerting
- On the Computing resource monitoring page, you can view the monitoring metrics of a compute node, including the CPU utilization, memory usage, inbound and outbound network traffic, QPS, query latency, number of frontend connections, and number of active threads.
- On the Storage Monitoring page, you can view the monitoring metrics of a storage node, including the CPU utilization, memory usage, disk space usage, inbound and outbound network traffic, number of connections, number of active threads, IOPS, QPS, TPS, buffer pool usage, and number of temporary tables.
SQL audit and analysis
PolarDB-X allows you to collect SQL audit logs and send the logs to Log Service. You can query logs in real time and transform the logs. You can also visualize log information for analysis and configure alerts based on the logs. To enable real-time SQL audit and analysis, turn on the switch of the feature in the console. You can also customize quasi-real-time monitoring and alerting for specific metrics. This way, you can receive alerts from multiple channels if exceptions occur in your business.
By default, the SQL audit and analysis feature is disabled. You can enable the feature in the PolarDB-X console. By default, audit logs are retained for 45 days. You are not charged for the SQL audit and analysis feature. You are charged based on the storage space, the traffic generated by read requests, the number of requests, the data processing service, and the data shipping service.
In the PolarDB-X console, you can view the sessions of an instance or terminate sessions. In the Session Statistics section, you can view aggregate data in different dimensions. For example, you can view the result of aggregating data by client or by namespace.
PolarDB-X provides the 10-second SQL analysis feature. When you use this feature, the system collects the session data once per second within 10 seconds and then summarizes and analyzes the sampling results. The analysis result shows whether the most frequently executed queries are slow SQL queries.
Slow query logs
PolarDB-X provides the slow query logs feature. You can view the CPU utilization of an instance and the number of slow queries on the instance on the same page. This can help you locate the SQL statements that affect the database performance. On the page for slow query logs, you can view the templates of slow SQL queries, the list of slow queries, and the details of each slow query, such as the number of executions, the execution duration, and the number of rows returned.
PolarDB-X provides diagnosis and optimization of slow SQL queries. The system provides suggestions on optimizing slow queries based on your SQL execution plans. For example, the system recommends that you create a local index or a global index.
Your business can be affected if a small number of SQL statements consume a large amount of resources. To prevent this issue, PolarDB-X provides the SQL throttling feature to limit the concurrency of specific queries. You can create throttling rules in the console to limit the maximum number of concurrent queries and the maximum length of the request queue. If a query is initiated after the maximum number of concurrent queries is reached, the query enters the request queue. If the number of queries in the queue exceeds the specified threshold, an error is reported.
The automatic SQL throttling feature can automatically identify slow queries and create throttling rules for these queries. If you want to use this feature, you must enable it.