Hey all!
Every time I publish or update a post in Wordpress on my CentOS there is a huge CPU spike and running # top shows its ~80% MySQL.
I have deactivated plugins and themes, and the problem persists, leading me to think that it is an issue with the database.
It also takes around 20-30 seconds for the Wordpress admin to load the publish/update for the post. It’s extremely slow performing this one task. Every thing else on the site is very fast.
Any help would be greatly appreciated!
Droplet Info: 4GB / 60GB CentOS 7.2 MariaDB 5.5
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
@hcassin
Shutdown MariaDB:
In
/var/lib/mysql
, backup the log files that start withib_logfile
, i.e.Then delete them from `/var/lib/mysql:
Now try pasting the same configuration below the same line as noted in my previous reply, save the file, and then start MariaDB:
@hcassin
Thanks!
Go ahead and run
systemctl stop mariadb
to shutdown MySQL, then open/etc/my.cnf
.Below this line:
… paste in:
Now close out and save the file and start MySQL using
systemctl start mariadb
.I just tested the above on a fresh CentOS 7 Droplet to make sure it’d work without any errors and it did, though if it fails to restart, please let me know and post the last 20-30 lines of the error log.
Normally, we want to evaluate the configuration over 24-48 hours to see how it’s working, so see how it works now and evaluate over that period.
@hcassin
It’s most likely not so much an issue with the database itself as it is with MariaDB if you’re running the stock installation and have yet to tweak/optimize the default configuration for better performance.
By default, the stock installation of MariaDB (or MySQL/Percona) is not setup for real production use as it’d be impossible to create a configuration that just works for anything, so it’s generalized.
Your MySQL configuration file should be located at either
or
If you would, please post the contents of this file in a code block and we can take a look at it.