How to Increase Apache Request Per Second ?
How to Increase Apache Request Per Second ?
Here’s how to increase Apache requests per second.
1. Install MPM module
For CentOS7/RHEL7 : Adjust /etc/httpd/conf.modules.d/00-mpm.conf
For Ubuntu/Debian : Use a2dismod / a2enmod to disable mpm_prefork and enable mpm_worker
2. Increase Max Connections in Apache
Open MPM configuration file:
CentOS/RHEL
$ sudo vi /etc/httpd/conf.modules.d/00-mpm.conf
Ubuntu/Debian
$ sudo vi /etc/apache2/mods-available/mpm_worker.conf
you will see the following lines
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxRequestWorkers 150
MaxConnectionsPerChild 0
In case you do not see the configuration , It means Apache is using the default configuration.
You can change them to the following configuration to increase max requests per second. The following configuration supports up to 8000 concurrent users
<IfModule mpm_worker_module>
ServerLimit 250
StartServers 10
MinSpareThreads 75
MaxSpareThreads 250
ThreadLimit 64
ThreadsPerChild 32
MaxRequestWorkers 8000
MaxConnectionsPerChild 10000
</IfModule>
You can also add the above lines to Apache web server configuration file, or Virtual host configuration file.
et’s quickly look at the parameters
Serverlimit – Maximum number of Apache processes
StartServers – Number of processes to start when you start running Apache
MinSpareThreads/MaxSpareThreads – Number of threads to keep idle without being killed
ThreadsPerChild – Number of threads per process
MaxRequestWorkers – Number of concurrent connections to be supported. This is the main directive that you need to change to increase max connections in Apache
MaxConnectionsPerChild – Number of connections to be handled by each child before it is killed
Open MPM configuration file:
To get the configurations to take effects , you have to restart the server.
Comments
Post a Comment