How to modify the maximum number of Apache 2 connections


Modify httpd Conf file
<IfModule prefork.c>
StartServers       8
MinSpareServers    5
MaxSpareServers   20
MaxClients       150
MaxRequestsPerChild  1000

MaxClients       150
ServerLimit        2000
MaxClients         2000


explain serviceMaximum number of processes allowed to be configured by the
grammar ServerLimit number
Default See instructions below
Scope server config
state MPM
modular prefork, worker

aboutpreforkMPM, this instructionset upYesMaxClientsThe maximum value allowed for configuration. aboutworkerMPM, this instruction andThreadLimitCombined useset upYesMaxClientsThe maximum value allowed for configuration. Any changes to this command during restart will be ignored, butMaxClientsThe changes will take effect.

Take special care when using this command. IfServerLimitset upAt a value much higher than the actual requirement, too much shared memory will be allocated. IfServerLimitandMaxClientsset upCheng YuyuesystemApache may not be able to start, orsystemWill become unstable.

aboutpreforkMPM, only if you need toMaxClientsset upThis instruction is only required when the default value is 256. To keep the value of this instruction at andMaxClientsSame.

aboutworkerMPM, only if you need toMaxClientsandThreadsPerChildset upThis instruction is required only when the default value of 16 child processes is exceeded. Do not set the value of this instructionset upRatio ofMaxClientsandThreadsPerChildA high number of child processes are required.

be careful

Apache has a hard limitation internally at compile time“ServerLimit 20000“(forpreforkMPM is“ServerLimit 200000“). You can’t go beyond this limit.