0% found this document useful (0 votes)
103 views

How Can I Troubleshoot and Resolve High Cpu Utilization On My Amazon Rds For Mysql, Mariadb, or Aurora For Mysql Instances?

Several factors such as user workloads, queries, deadlocks, transactions, or other processes can cause high CPU utilization on an Amazon RDS MySQL, MariaDB, or Aurora database instance. To troubleshoot, one should use Enhanced Monitoring, Performance Insights, or queries like SHOW PROCESSLIST to identify the specific source of the high CPU usage, and then optimize the workload accordingly to reduce CPU utilization.

Uploaded by

Farrukh Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views

How Can I Troubleshoot and Resolve High Cpu Utilization On My Amazon Rds For Mysql, Mariadb, or Aurora For Mysql Instances?

Several factors such as user workloads, queries, deadlocks, transactions, or other processes can cause high CPU utilization on an Amazon RDS MySQL, MariaDB, or Aurora database instance. To troubleshoot, one should use Enhanced Monitoring, Performance Insights, or queries like SHOW PROCESSLIST to identify the specific source of the high CPU usage, and then optimize the workload accordingly to reduce CPU utilization.

Uploaded by

Farrukh Khan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

How can I troubleshoot and resolve high

CPU utilization on my Amazon RDS for


MySQL, MariaDB, or Aurora for MySQL
instances?
Issue
I am experiencing high CPU utilization on my Amazon Relational Database Service (Amazon RDS)
for MySQL, MariaDB, or Amazon Aurora for MySQL instances. How can I troubleshoot and resolve
high CPU utilization?

Short Description
Several factors can cause an increase in CPU utilization. For example, user-initiated heavy
workloads, analytic queries, prolonged deadlocks and lock waits, multiple concurrent transactions,
long-running transactions, or other processes that utilize CPU resources.

First, you can identify the source of the CPU usage by:

 Using Enhanced Monitoring

 Using Performance Insights

 Using Queries to detect the cause of CPU utilization in the workload

 Analyzing logs and enabling monitoring


After you identify the source, you can analyze and optimize your workload to reduce CPU usage.

Resolution
Using Enhanced Monitoring

Enhanced Monitoring provides granular real-time metrics that you can review in addition to Amazon
CloudWatch metrics, which provide statistics each minute. For more information, see the Differences
Between CloudWatch and Enhanced Monitoring Metrics.

In the operating system (OS) process list section of Enhanced Monitoring, review the OS
processes and RDS processes to confirm the percentage of CPU utilization of a mysqld or Aurora
process. These metrics can help you confirm if the increase in CPU utilization is caused by OS or
RDS processes. You can also use these metrics to confirm if the increase is caused by the mysqld
or Aurora, which can indicate that a user-initiated workload is the source of the CPU usage. For
more information, see Viewing Enhanced Monitoring. You can also see the bifurcation of CPU
utilization by reviewing the metrics for cpuUtilization. For more information, see the Available OS
Metrics.

You can also check the number of tasks that aren't in use (sleeping tasks). These tasks can lead to
increased memory resource (RAM, cache, and processor) consumption, which can slow down the
server. It's a best practice to tune your application to gracefully close the connections that aren't in
use. You can also modify the values for the wait_timeout and interactive_timeout parameters to
close the connection based on the value you set. For more information, see the MySQL
Documentation for wait_timeout and interactive_timeout.
Using Performance Insights

You can use Performance Insights to identify the exact queries that are running on the instance and
causing high CPU usage. First, enable Performance Insights for MySQL. Then, you can use
Performance Insights to optimize your workload after consulting with your DBA.

To see which database engines are available to use with Performance Insights, see Using Amazon
RDS Performance Insights.

Using queries to detect the cause of CPU utilization in the workload

Before you can optimize your workload, you must identify the problematic query. You can run the
following queries while the high CPU issue is occurring to identify the root cause of the CPU
utilization. Then, you can optimize your workload to reduce your CPU usage.

The SHOW PROCESSLIST command shows you which threads are running currently on your
MySQL instance. Sometimes, the same set of statements is running but not finishing. When this
happens, the subsequent statements must wait for the first set of statements to finish, because
InnoDB row-level locking might be updating the same rows. For more information, see the MySQL
Documentation for SHOW PROCESSLIST Syntax.

SHOW FULL PROCESSLIST;

Note: Run the SHOW PROCESSLIST query as the master user. If you are not the master user, the
MySQL user running the command must have MySQL PROCESS server administration privileges to
see all the threads running on a MySQL instance. Without admin privileges, SHOW PROCESSLIST
shows only the threads associated with the MySQL account that you're using.

You might also like