====== Apache Web Server Tuning ======
Change default Apache ''prefork'' to ''event'' module.
===== For Ubuntu =====
https://www.interserver.net/tips/kb/apache-php-fpm-ubuntu-18-04/
a2dismod mpm_prefork
a2dismod mpm_worker
a2enmod mpm_event
systemctl restart apache2
==== With PHP ====
aptitude install php-fpm libapache2-mod-fcgid
a2enmod proxy
a2enmod proxy_fcgi
a2dismod php7.4
a2enconf php7.4-fpm
a2dismod mpm_prefork
a2dismod mpm_worker
a2enmod mpm_event
systemctl restart apache2
===== Enable to Event Module =====
* Edit /etc/httpd/conf.modules.d/00-mpm.conf
* Comment Line: LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
* Uncomment Line: LoadModule mpm_event_module modules/mod_mpm_event.so
===== Include Configuration File for MPM Event Module =====
* In /etc/httpd/conf/httpd.conf
* Add Line: IncludeOptional conf.d/mpm_event_module.conf
* (Add this line below other IncludeOptional lines)
===== Create the MPM Event Module Config File =====
Create /etc/httpd/conf.d/mpm_event_module.conf with below lines
# event MPM
# ServerLimit: Default 16.
# StartServers: initial number of server processes to start
# 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
# MaxRequestWorkers: maximum number of worker threads
# MaxConnectionsPerChild: maximum number of connections a server process serves
# before terminating
# ThreadLimit: Sets the upper limit on the configurable number of threads per child process. ThreadsPerChild can be modified during a restart up to the value of this directive.
ServerLimit 16
StartServers 3
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 25
MaxRequestWorkers 400
MaxConnectionsPerChild 8000
For 8,000 concurrent connections use this configuration.
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxRequestWorkers 8000
MaxConnectionsPerChild 10000
Ref: https://oxpedia.org/wiki/index.php?title=Tune_apache2_for_more_concurrent_connections