CPU spikes due to mysql


#1

Hi!

I’ve been experimenting with Easyengine for a bit and found myself comfortable enough to put it into production.

Now, having my server into production it performs quite well, exept some occasional and seemingly random CPU, Memory and Disk usage spikes.

It mostly seems due to mysql. I haven’t enabled redis caching on my sites from the start and I’m unable to update.

Is there something obvious I’m missing?


#2

Hey there,

Random spikes could happen for any number of reasons. To narrow it down you can prob do something as simple as look at your Google Analytics to match the traffic to the spike, or install a monitoring agent to really look at how your resource usage is doing by running some benchmarks while you measure.

But if your caching is turned off, then indeed MySQL will start to take a huge hit since more page loads mean more queries being made to the database directly – more so if you have many sites.

While I’m tempted to go into separating your DB server for any sort of production use, given your current setup your performance would improve dramatically if you use Redis caching.

You mentioned not being able to update… I’m assuming this is adding Redis to the site? The ee site update command is currently being developed for full EE4 inclusion which means ability to edit the --cache option for existing sites isn’t available just yet [0].

In the meantime you can always create a new server, install EE4, recreate the sites with Redis enabled, and migrate the WordPress data and run some tests to compare.

I know it sounds like a lot of work but it actually isn’t since you’d be running the new test servers (with Redis) using direct DNS hostname mapping from your local machine, so as to not affect the production sites that have correct DNS publicly.

Benefit of this approach is that when you upload your WXR file with your pages they’ll actually be able to “Download and import file attachments” correctly to an empty media library. Also, no database search/replace required since the URL would be the same.

[0] https://github.com/EasyEngine/site-command/issues/116


#3

Hi!

I’ve been looking at the server monitoring a bit and it seems like it is mostly really short MySQL spikes (even though the biggest sites on my server run WP Super Cache). I also have ran some websites with separate databases though my switch to EasyEngine was mostly to consolidate my tech to one VPS.

I had also been looking at the blog, though the Github Issue gives better insight into the development of the ee site update command.

Before I put EasyEngine in production I did make sure to feel comfortable with Docker and my migration app. This all works quite well! I even wrote a lil’ shellscript to restart all exited docker containers after a VPS reboot.

Thank you for the tips, i will keep experimenting on a separate server :wink: