Sites are very slow. Apache shows: server reached MaxClients setting

Created:

2016-11-16 13:03:25 UTC

Modified:

2017-08-16 17:38:25 UTC

4

Was this article helpful?


Have more questions?

Submit a request

Sites are very slow. Apache shows: server reached MaxClients setting

Applicable to:

  • Plesk for Linux

Symptoms

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

CONFIG_TEXT: [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. 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
  2. To resolve the issue with the MaxClients limit, adjust the /etc/httpd/conf/httpd.conf(/etc/apache2/conf/apache2.conf for Debian/Ubuntu) file, increasing the MaxClients value (e.g., to 100):

    CONFIG_TEXT: <IfModule prefork.c>
    StartServers 5
    MinSpareServers 10
    MaxSpareServers 25
    MaxClients 100
    MaxRequestsPerChild 10000
    </IfModule>

    CONFIG_TEXT: <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.

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

# grep -iRl "MaxClients /etc/

Have more questions? Submit a request

2 Comments

  • 0
    Avatar
    jan janetka

    The last command doesn't work for me, the double \\ at the end breaks it.

    Works fine with just: # find /etc -type f -exec grep -l 'MaxClients' {} \;

  • 0
    Avatar
    Vitaly Zhidkov

    @Jan, thank you for your notice, article has been just updated :)

Please sign in to leave a comment.