How do I troubleshoot Mariadb excessive cpu usage?
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?
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:
In general, here is some good general advice for troubleshooting this from my experience:
- Run through the MySQL Tuner guide to ensure it is tuned properly.
- 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?
- 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.