How to Increase Max Concurrent Connections in Apache?

increase max concurrent connections in apache

By default, Apache can handle up to 256 concurrent connections. Beyond that, your users will have to wait for response, or might get a “Request timed out” error. Here’s how to increase max concurrent connections in Apache.


How to Increase Max Concurrent Connections in Apache?

Here are the steps to increase max concurrent connections in Apache.

We will use the mpm_worker or mpm_event module for this purpose. It is also known as Multi-processing module (MPM). It consumes less RAM than mpm_prefork_module by starting lesser number of processes. Also, it provides much better performance for high traffic websites.

In this case, we use threads (instead of processes) to server requests. This allows us to server more requests, with a smaller memory footprint.

MPM module works based on 6 key parameters that control its performance and configuration. Basically, you need to set their values in apache conf file, or virtual hosts file and restart your Apache server to apply changes.

Here’s the default config:

ServerLimit 16
StartServers 2
MaxRequestWorkers 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadsPerChild 25


In the above configuration

  • ServerLimit – Maximum number of running apache processes
  • StartServers – Number of processes to start initially when starting the apache server
  • MinSpareThreads/MaxSpareThreads – Number of idle threads that can be kept alive without being killed.
  • ThreadsPerChild – No. of threads per process
  • ThreadLimit – Max value of ThreadsPerChild
  • MaxRequestWorkers – No. of concurrent connections supported. It was known as MaxClients till Apache 2.3.13
  • MaxConnectionsPerChild – No. of Connections that a process can handle during its lifetime. After that it will be killed. Useful to avoid memory leaks


By default, Apache will start 2 child processes and support up to 2×25 = 50 concurrent connections. Beyond that, Apache will create a new process to handle more connections. This will go on upto ServerLimit of 16, that is, upto 16 total processes, each serving 25 concurrent connections. Total = 400 concurrent connections.


Here’s a sample configuration to increase the above configuration to serve up to 1000 concurrent connections:

<IfModule mpm_worker_module>
  ServerLimit 40
  StartServers 2
  MaxClients 1000
  MinSpareThreads 25
  MaxSpareThreads 75
  ThreadsPerChild 25
  MaxRequestsPerChild 0


Here’s a sample configuration to increase the above configuration to serve up to 8000 concurrent connections:


<IfModule mpm_worker_module>
  ServerLimit 250
  StartServers 10
  MinSpareThreads 75
  MaxSpareThreads 250
  ThreadLimit 64
  ThreadsPerChild 32
  MaxRequestWorkers 8000
  MaxConnectionsPerChild 10000


Paste the above code in Apache’s config file, present at one of the following locations, depending on your linux

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf


Restart Apache Server to apply changes

$ sudo systemctl restart apache2 [Ubuntu/Debian]
$ sudo systemctl restart httpd [RHEL/CentOS]


About Sreeram Sreenivasan

Sreeram Sreenivasan is the Founder of Ubiq, a business dashboard & reporting platform for small & medium businesses. Ubiq makes it easy to build business dashboards & reports for your business. Try it for free today!