How do I troubleshoot Mariadb excessive cpu usage?

Linode Staff

Hi, I'm running several WordPress sites powered by a single MariaDB back end. None of the sites get much traffic and the server isn't doing much else but I constantly get these bursts of high CPU activity from MariaDB that can last for hours.

I've searched online for solutions but it's like going down the rabbit hole of possible MySQL config options. In your experience is there anything that commonly causes this?

2 Replies

Troubleshooting databases causing high cpu usage is not an easy task. I've compiled a list of similar post on this site regarding this issue to give you a few ideas:

Insane Mysql CPU Usage
MySQL Extremely High CPU usage
MySQL High CPU usage
MySQL using CPU all the time
How to figure out why MySQL is at 170 cpu load

In general, here is some good general advice for troubleshooting this from my experience:

  1. Run through the MySQL Tuner guide to ensure it is tuned properly.
  2. Enable the slow query log and analyze it. Are there specific queries that you can tie backs to specific WordPress plugins or actions that are bogging down the database?
  3. Similarly, take a look at MariaDB's SHOWPROCESSLIST command to get a bit more insight into what running under the hood.

A final thought, since you mentioned WordPress. Is this something that's been going on for a while, or is a relatively new? You could try disabling newly added plugins, or anything recent you've changed that could affect the database to try to narrow down what could be causing this.

Thanks, these are great resources to start troubleshooting with. This isn't a new problem; I'm just finally getting sick of it! The WP plugins idea is interesting. I sort of inherited one of the sites and it has a ton of plugins that I'm not familiar with. It's also the site that gets the most traffic. Anyway, I'll start digging through the various tools to get more info.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct