Question

Apache2 and MySQL processes repeatedly killed

Posted February 5, 2020 131 views
WordPressUbuntu 18.04Databases

I have done as much as possible. No matter what I do I cannot get these programs running again. My site is down and I have resized the droplet to have 16gb of ram and still it is killing processes.

screenshot of killed processes

That is a screenshot of the killed processes. Does anyone have an idea of what I can do?

edited by AHA

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
3 answers

Hi @shehethey,

When your server kills a process it’s usually because the said process, actually takes so much RAM that it might crash your server. In your case it’s MySQL. MySQL in itself won’t start generating load unless there are queries to be executed. Having said that, for queries to be executed there needs to be some trigger whether it’s someone opening your application/website which then executes the query to a cron job you’ve configured executing queries.

Basically, MySQL generating load is because there are queries however the queries are a consequence from another action. This is what you’ll need to find out what it is.

Alternatively, it’s possible there isn’t as much traffic to MySQL however your queries to need a longer time to be executed thus generating load. You can always check how many queries you currently have running and the time they have been running by typing in

mysqladmin proc

If there are a lot of queries however everyone show a time of under 50-60 seconds, then it would mean it’s either Website traffic or a cron job as we previously said.

It’s time to check if there is a lot of traffic on port 80 or 443. To do so, you have a couple of tools such as top,htop. These tools will show you the current processes in a graphical chart including but not only the memory each process takes, the time it has been running and the user that’s executing it. From there you can actually see which process is generating so much load.

If this proves fruitless, you might need to use the ps aux command. It shows all the processes running the time you executed the command. It provides you with process IDs which you can use to kill them.

The most common reason behind this is traffic. You can check the current traffic that is,has and trying to connect to your server by using the command nestat -punta.

Based on the information provided you’ll need to act and either block the Ip addresses if you feel they are not genuine or change your configurations.

Regards,
KDSys

It flagged my comment with the results of the command you gave me here are the results https://pastebin.com/6Z4tE62w

That looks like a lot of wordpress processes running. Check your access_log and see if you are getting hammered by XML-RPC requests from bots trying to hack their way into your server.

Submit an Answer