PHP-FPM High CPU Utilisation

Alteran Ancient

Well-known member
I moved my forum over to a new host using OpenVZ containers and long story short: They kept shutting us down because we would regularly reach a 5+ 15-minute CPU load average on a container with 2GB RAM and access to 4 Cores.

PHP-FPM was to blame every time. I even reconfigured the server to use OpenLSWS + LSPHP5, but this also did the same thing the moment we had more than a few users on the website. So I have moved us back to our old hosts for the time being, where the load average is consistently sitting between 4-5 - it also has access to 4 cores and 2GB RAM.

What is it that I am missing? The website is working and pages are being served to the clients in an acceptable time frame, but surely the CPU usage shouldn't be this high in order to serve ~122 users in a 15 minute time frame. I believe I have Zend Opcache and Memcached set up and running, but if that is the case and they are correctly configured, surely I shouldn't be maxing-out the CPU in this way?


Well-known member
If ZendOpcache and Memcached are up and running correctly, then it should reduce the load quite a bit as it should be storing the compiled PHP files, and removing queries from the DB.

What does top/htop show?

Alteran Ancient

Well-known member
Right now, not much at all. The load averages are now all not much above zero, despite the fact that there are "88 members browsing" as per the Members Online info. To try and keep tabs on this, however, I have started monitoring my VPS from a Dedicated server that I currently rent.

I did notice that the server traffic seems to shoot up inexplicably, as does the CPU load, but at those times, XenForo only seems to be reporting about 120 browsers while this is happening.

Attached are some graphs that I have pulled from PRTG - I only started monitoring it since the 27th.



I cannot account at all for this extra traffic, but this can't the result of 120 clients requesting data from an active XenForo installation, surely? I'm starting to believe that this CPU load is not necessarily being caused by PHP-FPM being configured badly, but rogue traffic.

Alteran Ancient

Well-known member
Anything in crontab maybe? a Backup process or similar.
I don't actually have any cron tasks set up. I seem to have gone through 24 hours without any of those strange spikes occurring, so the mystery continues to elude me.



You can probably ignore the most recent "spike" on the traffic graph - that would be me TARing and then rsyncing several GBs of data off of the machine.