To determine which MPM is currently configured, use the following command:
sudo httpd -V | grep -i mpm
The Worker Module is ideal for multi-threaded applications and environments. It uses a single parent process that creates multiple child processes, each with many threads, thereby handling many requests simultaneously.
httpd.confEdit the /etc/httpd/conf/httpd.conf file to configure the Worker Module. Adjust the configuration based on your server's hardware and workload:
# File: /etc/httpd/conf/httpd.conf
<IfModule mpm_worker_module>
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxRequestWorkers 8000
MaxConnectionsPerChild 10000
</IfModule>
To calculate the optimal configuration for your Apache 2.4 setup, consider the memory and process requirements based on your server's specifications.
The provided data can be used as a reference for configuring Apache processes and memory allocation in line with your server's hardware capabilities.
On CentOS 9, switch to the Worker module by editing the /etc/httpd/conf.modules.d/00-mpm.conf file:
# File: /etc/httpd/conf.modules.d/00-mpm.conf
# LoadModule directives for different MPMs
#LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule mpm_worker_module modules/mod_mpm_worker.so
#LoadModule mpm_event_module modules/mod_mpm_event.so
Comment out the lines for the Prefork and Event modules, and uncomment the line for the Worker module.
After updating the configurations, restart Apache to apply the changes:
sudo systemctl restart httpd