optmisticcom
optmisticcom

Reputation: 73

Apache Max Connections

we are using Ubuntu 16 LTS as a webserver with apache2.4, 18GB RAM and 20 cpus. I have issued following command

$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 72012
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 72012
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Apache Version

$ apache2 -v
Server version: Apache/2.4.18 (Ubuntu)
Server built: 2018-04-18T14:53:04

Apache Module current in use

$ a2query -M
prefork

and MPM prefork module is used with default settings

<IfModule mpm_prefork_module>
        StartServers             2
        MinSpareServers          5
        MaxSpareServers          10
        MaxRequestWorkers        400
        MaxConnectionsPerChild   0
</IfModule>

I haved checked the maximum apache processes by JMeter stress tester and it doesnot expand more than 1500 processes. It is also checked that when 1500 processes are reached the RAM has still plenty of space (i.e. 9GB still remains).

Process count is identified by following command

ps -ef | grep apache2 | wc -l

Guidance required to increase that 1500 number as we need to stick with MPM_prefork module.

Upvotes: 2

Views: 17964

Answers (1)

Hendrik Prinsloo
Hendrik Prinsloo

Reputation: 329

Try to change the ServerLimit in your config, see here.

You can also consider having a look at apache2buddy for guidance on tweaking your configuration.

Side note

Note that there is a hard limit of 15000.

Extract from Apache's documentation here

There is a hard limit of ThreadLimit 20000 (or ThreadLimit 100000 with event, ThreadLimit 15000 with mpm_winnt) compiled into the server. This is intended to avoid nasty effects caused by typos. To increase it even further past this limit, you will need to modify the value of MAX_THREAD_LIMIT in the mpm source file and rebuild the server.

Upvotes: 2

Related Questions