修改apache最大连接数

# prefork MPM
# StartServers ……… number of server processes to start
# MinSpareServers …… minimum number of server processes which are kept spare
# MaxSpareServers …… maximum number of server processes which are kept spare
# MaxClients ……….. maximum number of server processes allowed to start
# MaxRequestsPerChild .. maximum number of requests a server process serves
<IfModule prefork.c>
StartServers         5
MinSpareServers      5
MaxSpareServers     10
MaxClients          20
MaxRequestsPerChild  0
</IfModule>
 
# pthread MPM
# StartServers ……… initial  number of server processes to start
# MaxClients ……….. maximum  number of server processes allowed to start
# MinSpareThreads …… minimum  number of worker threads which are kept spare
# MaxSpareThreads …… maximum  number of worker threads which are kept spare
# ThreadsPerChild …… constant number of worker threads in each server process
# MaxRequestsPerChild .. maximum  number of requests a server process serves
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>
 
 
注意,如果不知道自己的apache2使用哪种工作模式,最简单的方法,先restart一下apache2,然后netstat -t 看看有几个apache2的进程,然后对比一下就可以了
ps:
apache2默认最大256连接,如果需要更大,自己手动编译

Leave a Reply

Your email address will not be published. Required fields are marked *