Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

SQL CPU usage doubles from 20% over 40%

Hello,
we have a problem with a MySQL 5.6.51-google-log server. Sometimes, with no apparent reason, the CPU usage doubles from 20% over 40% and remains high until, during the night, some "cleaning" operations occur on the tables.
No other metric (memory usage, connections, I/O operations, bytes IN and OUT, InnoDB pages reads and writes, etc.) follow this trend and remain substantially unchanged.
We activated the slow query log but nothing results there.

Does anybody experienced the same problem ? Do you have any suggestion ?

0 1 257
1 REPLY 1

Hi @dew54,

Welcome to Google Cloud Community!

This issue could be caused by a number of factors, including high traffic, inefficient queries, or a lack of proper indexing on the tables. It's also possible that there is a problem with the server configuration.

To troubleshoot the problem, you can start by checking the slow query log to see if there are any particularly slow or resource-intensive queries that may be causing the high CPU usage. Additionally, you can use the `SHOW PROCESSLIST` command to see a list of all currently running queries and their status.

Another way to troubleshoot is by using the performance_schema tables to identify which queries are using the most CPU. This can be done by running the following query:

SELECT * FROM performance_schema.events_statements_summary_by_digest
ORDER BY SUM_TIMER_WAIT DESC LIMIT 10;

You can also check the Google Cloud documentation for best practices on optimizing MySQL performance on the platform, which can be found here: https://cloud.google.com/sql/docs/mysql/best-practices

It would also be helpful to check if there is any scheduled maintenance, backup, or updates that are causing the increased CPU usage.

If you continue to experience the problem, you may want to contact Google Cloud support for further assistance.

Thank you