Apache 2.4 php 7.2 Apache ( php module) increase max connections to handle 10000

7k views Asked by At

I have project with apache(2.4) and php(7.2), which apache uses mpm_fork how can I increase max connections in apache to handle 10,000 cocurrent connections ? I'm testing with https://loader.io , It just can handle max to 5000 concurrent connections ( in 15 s ).

this is my current apache config :

DefaultRuntimeDir ${APACHE_RUN_DIR}
Timeout             300
<IfModule prefork.c>
    StartServers            100
    MinSpareServers         100
    MaxSpareServers         100
    ServerLimit             10000
    MaxClients              10000
    MaxRequestWorkers       10000
    MaxRequestsPerChild     4000
</IfModule>
PidFile ${APACHE_PID_FILE}
KeepAlive On
MaxKeepAliveRequests 1000
KeepAliveTimeout 5
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
HostnameLookups Off
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
Include ports.conf
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>
<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

AccessFileName .htaccess
<FilesMatch "^\.ht">
        Require all denied
</FilesMatch>

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent

IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf
ServerName localhost

consider, there is no problem with my hardware, I checked my resource usage, I never passed 20 % usage of cpu and memory during my tests.

1

There are 1 answers

0
Majid Abdolhosseini On BEST ANSWER

The best tuning I found for Apache which already working on my server perfectly is this part :

<IfModule prefork.c>
    StartServers            20
    MinSpareServers         20
    MaxSpareServers         50
    ServerLimit             5000
    MaxRequestWorkers       5000
    MaxRequestsPerChild     10000
</IfModule>

I belive this config is good for high traffic servers.