Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page
Help Center/ Data Admin Service/ Best Practices/ Fixing High CPU Usage on DAS

Fixing High CPU Usage on DAS

Updated on 2024-12-30 GMT+08:00

High CPU usage is caused by the following reasons:

  • Slow SQL queries

    Slow SQL queries are inefficient because a large amount of data causes high I/O usage and low QPS. You can view the CPU usage, QPS, and row read rate on the DAS performance page. To solve the issues, you can kill sessions or optimize indexes through SQL diagnosis.

  • High-concurrent connections

    When QPS of a DB instance increases, it has to process a large number of concurrent operations at the same time, and the CPU usage increases accordingly. On the DAS performance page, you can view metrics such as QPS, number of active connections, and CPU usage. To solve the issues, you can use functions such as SQL statement concurrency control and auto flow control or kill sessions. After core services are restored, you can evaluate whether the issues were caused by service anomaly and adjust the services if necessary. You are advised to upgrade instance specifications if they cannot meet increasing service demands.

Solution (MySQL as an Example)

If a Huawei Cloud database pushes an alarm indicating that CPU usage of the DB instance increases sharply, the SRE will:

  1. Log in to the DAS console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner. Choose Databases > Data Admin Service.
  4. In the navigation pane, choose Intelligent O&M > Instance List.

    Alternatively, on the Overview page, click Go to Intelligent O&M.

  5. In the upper right corner of the instance list, filter instances by engine, name, or IP address. Click Details to go to the Dashboard tab page.

    Figure 1 Intelligent O&M

  6. Click the Performance tab.

    Figure 2 Performance monitoring

  7. Check key metrics, such as current active connections, total connections, QPS, slow query logs, and CPU usage.

    Figure 3 Current Active Connections
    Figure 4 Total Connections
    Figure 5 QPS
    Figure 6 Slow Query Logs
    Figure 7 CPU Usage

  8. Verify the CPU usage increases sharply due to a sudden surge of slow query logs and high-concurrent connections.
  9. Click the SQL tab and then Slow Query Logs to view details.

    Figure 8 Slow Query Logs

    A large number of same slow query logs are sent in a short period of time. Executing a single SQL statement takes about 1 minute. The SRE and service department decide to restrict this type of SQL statement and restore other core services of the database.

  10. Click the SQL Statement Concurrency Control tab and enable Concurrency Control.
  11. Create an SQL concurrency control rule, select SELECT for SQL Type and Using SQL statements for Keyword Generation, enter the original SQL statement, click Generate Keyword, set Max. Concurrency to 1, and kill the existing sessions that meet the rule.

    Figure 9 SQL type
    Figure 10 Selecting a SQL statement concurrency control rule

    The SQL statement concurrency control rule has taken effect and the SQL statements that match the rule are intercepted.

  12. Click the Performance tab and check the database performance metrics. The CPU usage starts to decrease and the service department reports that core services have recovered.

    Figure 11 Performance metrics

    After the SQL statement concurrency control takes effect, no same slow query is logged.

    Figure 12 Slow queries over time
    Figure 13 Performance metrics

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback