High CPU load on Rocky 8.6

Hi folks,

I have an unusual high CPU load on my Rocky 8.6 server since a few days. I use it exclusively as a web server (nginx 1.22.0) and have no idea why the CPU load is suddenly permanently over 50% - noticeable are the 3 services in the screenshot (CPU-Rocky — ImgBB) - can anyone help me?

As sendmail has quite a high amount of CPU, check the mailqueue using mailq command. If there are a lot of emails in the queue, then you need to figure out if these are genuine, or maybe your server is an open relay and spamming thousands of messages and hence the CPU usage.

Unfortunately, the screenshot on it’s own isn’t enough - you will need to provide more info for example the specs of the machine - CPU speed, etc, what other processes are running on the server other than nginx. Do you also have a database like mariadb also running on it or even PHP.

1 Like

Thanks for the helpful hint.
There are countless mail in the queue and I also know where they come from. I have set up a faulty cronjob. Unfortunately, I caught crontab -r instead of crontab -e earlier and can no longer understand what was wrong. But the CPU load is now back to 1% - so the problem is solved. Unfortunately I don’t know anymore if there were any other relevant cronjobs set up. Are cronjobs set up under root after the basic installation? If not, everything should fit, I have even next only the faulty cronjob set up, which was responsible for the problems.

How can I delete the mail queue again?

1 Like

The easiest way will be to stop sendmail, and then just do:

# cd /var/spool/mqueue/
# ls
# rm *

and restart sendmail. Postfix is far easier though, it has tools that you can do this with, without having to resort to deleting manually like the above. In postfix you would just do:

postsuper -d ALL

I much prefer postfix to sendmail personally :slight_smile:

1 Like

thx - now everything is fine again!