• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue A lot of www-data processes causing Apache to crash

Luiz_Gustavo

Basic Pleskian
Server operating system version
Ubuntu 16.04
Plesk version and microupdate number
18.34
Hello,

One server is currently experiencing an issue with Apache. This server has been running smoothly for years without any configuration modifications.

Today, Apache is shutting down after exceeding the MaxRequestWorkers setting.

[Tue Oct 17 14:50:08.017960 2023] [mpm_prefork:error] [pid 193209] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting [Tue Oct 17 15:26:01.729692 2023] [mpm_prefork:notice] [pid 193209] AH00169: caught SIGTERM, shutting down

The default value was set at 150. I've increased it to 400 and also set the ServerLimit to 400. However, Apache continues to hit this limit.

The process associated with this issue is labeled as `www-data`. I'm unsure how to troubleshoot this, as I can't determine if it's a website, webmail, or another Plesk process that's causing the situation.

www-data 105909 0.0 0.5 171480 42336 ? S 17:48 0:00 /usr/sbin/apache2 -k start
www-data 105924 0.0 0.5 171548 42372 ? S 17:48 0:00 /usr/sbin/apache2 -k start
www-data 105929 0.0 0.5 171448 42308 ? S 17:48 0:00 /usr/sbin/apache2 -k start
www-data 105930 0.0 0.5 171404 42232 ? S 17:48 0:00 /usr/sbin/apache2 -k start
www-data 109096 0.0 0.5 171404 42216 ? S 17:49 0:00 /usr/sbin/apache2 -k start

The number of processes continues to rise until it hits the set limit. Currently, there are 163 processes, which is OK. However, it has reached the 400 limit twice since I made the adjustment.

Any suggestions or guidance would be greatly appreciated.

My config for prefork

<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 400
ServerLimit 400
MaxConnectionsPerChild 0
</IfModule>



Thanks!

Luiz
 
You'll need to examine your access_ssl_log and error_log log files of your domains to determine the cause for the high load. Normally it is caused by a combination of "bad bots" with a not so well programmed script that runs a long time or enters infinite loops so it only stops when the max_execution_time setting in PHP is reached. In that case you can lower the max_execution_time setting in PHP, you can lower the number of concurrent PHP instances of a single domain. Another idea can be to apply the Fail2Ban Bad Bot filter. If you have many domains on your server, you can find the domain that causes the issues by listing the processes like "ps aux | grep php-fpm" and check the domains that are mentioned several times in that list.
 
Back
Top