Moodle causing 100% CPU usage suddenly

Moodle causing 100% CPU usage suddenly

by Hasibuzzaman Tonmoy -
Number of replies: 2

I used to host a Moodle site alongside 4-5 different WordPress sites in a single DigitalOcean Ubuntu 20.04 LEMP stack droplet (4 CPUs, 8GB RAM).

We barely had 5-6 concurrent users so we never needed the horsepower and the site ran just fine. A couple days ago, we suddenly started getting 504 gateway errors. I logged in to my server and saw that all 4 CPUs were being used 100% by php-fpm. I tried figuring out what's actually causing the issue but couldn't find it out.

So, I decided to move Moodle to completely separate server and it's the exact same problem. As soon as the migration has been completed and the site went live, the CPU usage spiked to constant 100%. No one except for me is using the site. I can't even get to the admin panel, it crashes to 504 error

htop

Average of ratings: -
In reply to Hasibuzzaman Tonmoy

Re: Moodle causing 100% CPU usage suddenly

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
It's doing something... what are all those mysqld processes doing (do a 'show processlist')?

You could also try...

strace -p 75362

(substitute current PID). You'll got more info than you may like but something may jump out.
In reply to Hasibuzzaman Tonmoy

Re: Moodle causing 100% CPU usage suddenly

by Roy Plomantes -
You might probably consider also to check your mpm_event and php-fpm pool configurations as these may cause the overloading of your CPU and memory resources.
Average of ratings: Useful (2)