• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.
  • We’re working on enhancing the Monitoring feature in Plesk, and we could really use your expertise! If you’re open to sharing your experiences with server and website monitoring or providing feedback, we’d love to have a one-hour online meeting with you.

Resolved Increase Apache2 MaxClients

daanse

Regular Pleskian
Hi,

i have some Problems, that my Monitoring shows low Idle workers.
This somehow, as for what I understood could be Problem of "MaxClients"
worker - Apache HTTP Server Version 2.2

Therefore and even (because sometimes Apache2 wont start after Update (Sigte... shutting down) i want to try to increase "MaxClients" Apache Value. But I can't find them.
I grep and searched everything in /etc/apache2/* and these Values are not there.

System:
Plesk 17.5 / Debian 8.x and Ubuntu 16...

I looked to following Articles:
- Websites sind sehr langsam: Der Fehler „server reached MaxClients setting“ wird im Protokoll angezeigt
- plesk httpd service getting down after every 2 to 3 hours
- Apache2 - where to set maxclients?

I don't get it. As i can't find those Values i have following Questions:

Are the Values like "MaxClients" not relevant, don't i need them?
If i need them: where do i have to insert them/ paths?
What would you recommend (Tuning Apache2 i.e. for more than 300 Websites on one Hand)
And what would you recommend generally to tune Apache2 with these Values?
 
Hi daanse,

pls. be informed about the following documentations:


I don't get it. As i can't find those Values
As stated at your mentioned KB - article:
1) Apache ist in Parallels Plesk standardmäßig nicht für Websites mit hoher Last konfiguriert. Wir empfehlen daher, den Apache Server abzustimmen . Um das hier genannte Problem mit der MaxClients -Grenze zu beheben, müssen Sie die Datei /etc/httpd/conf/httpd.conf anpassen: Erhöhen Sie den Wert für MaxClients (z. B. auf 100):

<IfModule worker.c> StartServers 1 MaxClients 100 MinSpareThreads 1 MaxSpareThreads 4 ThreadsPerChild 25 MaxRequestsPerChild 0 </IfModule>

( or as stated at the ENGLISH version)
  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 .
  2. To resolve the issue with the MaxClients limit, adjust the /etc/httpd/conf/httpd.conf file, increasing the MaxClients value (e.g., to 100):

    Code:
    <IfModule prefork.c>
    StartServers 1
    MaxClients 100
    MinSpareThreads 1
    MaxSpareThreads 4
    ThreadsPerChild 25
    MaxRequestsPerChild 0
    </IfModule>
... the initial Plesk setup comes without additional configuration and you have to add it manually, if you desire this modification. ;)


Pls. note as well the important note:
HINWEIS: Sofern Sie Debian/Ubuntu Linux Distributionen verwenden, müssen Sie in der obigen Anleitung "/etc/httpd" durch "/etc/apache2" ersetzen und "/var/log/httpd" durch "/var/log/apache2".

( or as ENGLISH version)
NOTE: If you are using Debian/Ubuntu Linux distributions, replace "/etc/httpd" with "/etc/apache2" and "/var/log/httpd" with "/var/log/apache2".



Are the Values like "MaxClients" not relevant, don't i need them?
If you desire to add this modification to your apache2 - configuration, then the answer is: YES.


If i need them: where do i have to insert them/ paths?
You already found the corresponding Plesk KB - article with the provided resolutions. Pls. follow them and if you experience issues/errors/problems, pls. describe WHAT you did, WHAT you edited and try to include YOUR current apache2 - configuration files, so that people willing to help you are able to investigate your root cause together with you.


What would you recommend (Tuning Apache2 i.e. for more than 300 Websites on one Hand)
The mentioned Plesk KB - article already suggests possible modifications and it states as well:
Hinweis: Wenn das Problem bestehen bleibt, sollten Sie in Betracht ziehen, die Grenze MaxClients erneut zu erhöhen, bis das Problem behoben ist.

( or as stated at the ENGLISH version)
Note: if the error persists, consider increasing MaxClients limit again until the issue is fixed.


And what would you recommend generally to tune Apache2 with these Values?
There is no general recommendation for such an additional setting, which will fit every server configuration, as it really depends on your server, the server hardware, your unique server configuration and last but not least the unique traffic of your hosted domains. :(
 
HI @UFHH01
thank you.

1. I will edit the /etc/apache2/apache2.conf with following Settings:
Code:
<IfModule prefork.c>
StartServers 1
MaxClients 100
MinSpareThreads 1
MaxSpareThreads 4
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>

But before that, how can i find out the current MaxClients Settings? I want to know the current setting, to know that my "MaxClients 100" Setting is more than before.
Do you understand?

After that, hopefully i will get rid of Problems :)
Am i right, that this could be also the Problem with the idle workers? My Monitoring shows idle Workers <5 and warns me.


EDIT:

i did as docs said but get Errors, couldn't restart apache2
Please see Screenshots.
So i deleted those Commands.

i have inserted:
Code:
<IfModule prefork.c>
StartServers 1
MaxClients 100
</IfModule>
 

Attachments

  • Bildschirmfoto 2017-07-27 um 14.19.54.png
    Bildschirmfoto 2017-07-27 um 14.19.54.png
    1.2 MB · Views: 18
  • Bildschirmfoto 2017-07-27 um 14.20.32.png
    Bildschirmfoto 2017-07-27 um 14.20.32.png
    1.2 MB · Views: 16
Last edited:
Hi @UFHH01,

Output is:
Code:
Server version: Apache/2.4.10 (Debian)
Server built:   Jul 18 2017 18:32:16
Server's Module Magic Number: 20120211:37
Server loaded:  APR 1.5.1, APR-UTIL 1.5.4
Compiled using: APR 1.5.1, APR-UTIL 1.5.4
Architecture:   64-bit
Server MPM:     prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"

and

Code:
Loaded Modules:
 core_module (static)
 so_module (static)
 watchdog_module (static)
 http_module (static)
 log_config_module (static)
 logio_module (static)
 version_module (static)
 unixd_module (static)
 access_compat_module (shared)
 actions_module (shared)
 alias_module (shared)
 auth_basic_module (shared)
 auth_digest_module (shared)
 authn_core_module (shared)
 authn_file_module (shared)
 authz_core_module (shared)
 authz_host_module (shared)
 authz_user_module (shared)
 autoindex_module (shared)
 bw_module (shared)
 cache_module (shared)
 cgi_module (shared)
 cloudflare_module (shared)
 dav_module (shared)
 dav_fs_module (shared)
 dav_lock_module (shared)
 deflate_module (shared)
 dir_module (shared)
 env_module (shared)
 expires_module (shared)
 fcgid_module (shared)
 filter_module (shared)
 headers_module (shared)
 include_module (shared)
 mime_module (shared)
 mpm_prefork_module (shared)
 negotiation_module (shared)
 pagespeed_module (shared)
 perl_module (shared)
 proxy_module (shared)
 proxy_fcgi_module (shared)
 python_module (shared)
 reqtimeout_module (shared)
 request_module (shared)
 rewrite_module (shared)
 security2_module (shared)
 session_module (shared)
 setenvif_module (shared)
 socache_shmcb_module (shared)
 ssl_module (shared)
 status_module (shared)
 suexec_module (shared)
 sysenv_module (shared)
 unique_id_module (shared)
 userdir_module (shared)
 xml2enc_module (shared)
 
Hi daanse,

pls. try using something like:
Code:
<IfModule prefork.c>
StartServers           5
MinSpareServers        10
MaxSpareServers       25
MaxClients            100
MaxRequestsPerChild 10000
</IfModule>

... as "MinSpareThreads" / "MaxSpareThreads" and "ThreadsPerChild" are used by "worker", but not by "prefork" ( according to the official apache documentation, mentioned above! )


Maybe @IgorG will pass over the Plesk documentation mistakes over to the responsible Plesk - Team - Members?
 
Hi @UFHH01 ,

thank you very much.
I used:
Code:
# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 8500
</IfModule>

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
StartServers 5
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25
MaxRequestsPerChild 8500
</IfModule>

Is this ok too? Will this take affect?
I will watch my monitoring but i have nothing to verify if these Settings are recognized by Plesk.
 
Hi daanse,

but i have nothing to verify if these Settings are recognized by Plesk.
Plesk itself has got nothing to do with your unique modifications for your apache2 webserver.
You just have to monitor your apache - log - files, to see if your modifcations are already sufficient to get rid of your warnings/notices. ;)


Is this ok too? Will this take affect?
As I stated before, no one else but the server administrator can tell you, if your modifications are sufficient/reasonable for your server and the hosted domains. Tweaking the apache2 webserver will take time and monitoring efforts. :)
 
Hi @UFHH01 ,

thank you again for your professional help! I looked at it today, seems nothing has changed.
Then i inserted your Code:

Code:
<IfModule prefork.c>
StartServers           5
MinSpareServers        10
MaxSpareServers       75
MaxClients            150
MaxRequestsPerChild 10000
</IfModule>

And monitoring "idle worker" immediately went up to 10 :). So this worked out for me.
Still not know if its possible to verify this "MaxClients" per command. But thats ok.
 
Hello,

I use Debian and my apache version is
Server version: Apache/2.4.10 (Debian)

I don´t have any references to <IfModule prefork.c> or MaxClients in /etc/apache2/apache2.conf. So, I have to add this in the file?

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

Thanks in advance
 
Back
Top