I am bit worried about the number of processes on my server. I see plenty apache and mysql processes after a reboot. I am worried they will start eating up too much resources and bring the server down. Is this the default config for apache and mysql? I did not mess with config files at all. Should I consider setting the number of child processes for each in their respective config? 
- 121
- 5
-
2Probably relevant: [this](https://superuser.com/q/118086/432690), [that](https://unix.stackexchange.com/q/364660/108618) and [more](https://stackoverflow.com/a/9154725/10765659). – Kamil Maciorowski Jan 25 '21 at 20:10
-
1Those extra processes will likely allow the system to handle more simultaneous connections. The output you provided shows a system that is lightly loaded with plenty of memory available. If you load up the system and see the CPU's or memory taxed, maybe tune down the processes a little. Otherwise, I wouldn't worry about it. – mikem Jan 26 '21 at 04:56
-
My issue is that once a month the memory gets eaten up and I have to reboot the server. I need to figure out where the culprit is. Whether it's a open mysql handle in apache or whether it's a configuration issue. – El Dude Jan 26 '21 at 19:56
1 Answers
The default Apache config is very generic. It spawns a number of child processes for resilience but it does not know anything of your use case. Apache recommends you tune the number of workers to avoid swapping that is detrimental to performance:
A webserver should never ever have to swap, as swapping increases the latency of each request beyond a point that users consider "fast enough". This causes users to hit stop and reload, further increasing the load. You can, and should, control the MaxRequestWorkers setting so that your server does not spawn so many children that it starts swapping.
MySQL generally starts with a single process, so I am surprised to see that many. You may want to check how many are running on startup, to see if it created the extra processes in response to a certain workload. There is probably a config to control that but I don't know that one.
- 3,296
- 5
- 26
- 32
-
Thanks for the pointers. I'll look into it. I also am surprised about how many `mysql` processes there are. In fact it's MariaDB I realize now (should have stated that in the issue). However, I am worried there's a bug somewhere that keeps connections to the backend open... – El Dude Jan 25 '21 at 23:15
-
But hang on, `mysqld` is the daemon process, so the parent process, not a child one... ? – El Dude Jan 25 '21 at 23:16
-
The daemon process just means it's a background process as opposed to a client application, such as command line tool issuing commands. The child process in this model is called the same, just like apache which used to be named `httpd`' that's since when a process calls fork() both proceses are the same name – Itai Jan 26 '21 at 00:40