Hi,
We’re running about 30 websites on Apache2/MariaDB using Virtualmin Pro. Most of the websites are Wordpress sites. The problem we’re experiencing is that the FPM pools are using a lot of CPU in relation to how few visitors the websites get. There are no truly high-traffic websites. The busiest site gets around 2000 unique visitors per day, most others only get a fraction of that.
Even with so few visitors, many pools constantly spin up to 60 - 100% CPU for long periods of time. When this happens to several websites at once, it can bring down the entire server, which happens a few times per day. There’s plenty of free memory, and the MariaDB process doesn’t use much CPU, just the FPM pools. There’s no one specific website that uses a lot of CPU, they all seem to frequently hammer the CPU even when we can confirm there are no or very few active visitors.
The server was running as a D4s V3 in Azure (4 cores, 16 GB RAM) although we temporarily upgraded it to D8s V3 (8 cores, 32 GB RAM) to be able to handle the CPU spikes for now.
I’m wondering if there’s some configuration issue in Virtualmin, PHP or Apache that’s causing this. We’ve tried tweaking the FPM pool settings and the MPM Event config in Apache2 using various suggestions found online, but this doesn’t seem to help. I’ve also looked through the PHP and error logs but didn’t find anything that stood out.
Since it is popular, Word Press ‘enjoys’ a status of a large attack vector application. I know several have mentioned Word Fence as a general defense tool. I’m not saying this is your problem here, but it is something to maybe look at. It could be bots/scripts trying to abuse something and just holding connections open.
Obviously I have NO clue as to your level of experience here. Just kinda the first thing that popped into my mind. I think there was a post recently about the pools persisting too long and there was some sort of constraint applied. Maybe child processes?
Quick search turns up this doc that seems decent at understanding and tuning the processes. Keep us informed if this helps and no one offers a real answer here.
FPM offers you an option for an on-demand execution mode in the Virtualmin GUI. If your choose this mode for those of your websites which have the least traffic but consume resources disproportionately, you might be able to prevent your system from crashing repeatedly.
FPM on demand trades RAM for CPU and user experience; static does the opposite of that. Use either judiciously for specific virtual servers.
I run wordrpress sites too and I found running the PHP with the ondemand option helps reduce CPU usage. You could try that. I have this setting in the Template