Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Sites are very slow. Apache shows: server reached MaxClients setting on Plesk fo  (Read 2294 times)

0 Members and 1 Guest are viewing this topic.

sibij

  • Guest
Symptoms >:(

Loading the website takes too much time. The following error appears in the /var/log/httpd/error_log :


Code: [Select]
error] server reached MaxClients setting, consider raising the MaxClients setting
[warn] mod_fcgid: process 2968 graceful kill fail, sending SIGKILL
Cause

The connections limit defined by MaxClients is reached.
Resolution

  1.  Connect to the server via SSH.
  2. By default, Apache in Plesk is not configured for high-loaded sites. It is recommended to tune Apache performance as it described here: http://httpd.apache.org/docs/2.2/misc/perf-tuning.html  or https://httpd.apache.org/docs/2.4/misc/perf-tuning.html

    3. To resolve the issue with the MaxClients limit, adjust the /etc/httpd/conf/httpd.conf(/etc/apache2/conf/apache2.conf for Debian/Ubuntu) file on SystemV OSes (CentOS 6 or lower), increasing the MaxClients value (e.g., to 100):
Code: [Select]
    <IfModule prefork.c>
    StartServers 5
    MinSpareServers 10
    MaxSpareServers 25
    MaxClients 100
    MaxRequestsPerChild 10000
    </IfModule>

    <IfModule worker.c>
    StartServers 5
    MinSpareThreads 10
    MaxSpareThreads 25
    ThreadsPerChild 50
    MaxClients 100
    MaxRequestsPerChild 10000
    </IfModule>

Note: For CentOS 7, file /etc/httpd/conf.d/mpm_prefork.conf should be edited instead of <IfModule prefork.c> section. If the error persists, consider increasing MaxClients limit again until the issue is fixed.
For Debian/Ubuntu, use the following files /etc/apache2/mods-available/mpm_prefork.conf and /etc/apache2/mods-available/mpm_worker.conf


If the error is still shown, check all files where MaxClients directive defined. It can be done with the following command:

Code: [Select]
# grep -iRl "MaxClients" /etc/
If there is no such option at all, add it manually to files listed above.