如何設置apache的併發數量apache
一、在httpd.conf文件中修改編程
#Server-pool management (MPM specific)併發
#Include conf/extra/httpd-mpm.conf測試
將上面一句的#註釋去掉網站
二、肯定當前的apache是什麼MPM模式(winnt模式,perfork模式,worker模式)線程
進入到apache/bin目錄server
cmd命令:httpd.exe -l進程
說明:看mpm_xxx.c 若是xxx是winnt 說明是winnt,另外還多是perfork或者workerci
三、修改httpd-mpm.conf文件get
# WinNT MPM
# ThreadsPerChild: constant number of worker threads in the server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_winnt_module>
ThreadsPerChild 150 //修改這個值便可
MaxRequestsPerChild 0
</IfModule>
四、重啓apache,測試看看
在Linux下,通常採用的MPM是perfork模式
<IfModule mpm_prefork_module>
StartServers 5 //預先起5個進程
MinSpareServers 5 //最小空閒進程
MaxSpareServers 10 //最大空閒進程
MaxClients 150 //併發鏈接數
MaxRequestsPerChild 0 //指一個進程裏能夠起多少個線程,對worker更好,0爲不限制
</IfModule>
給你們一個合理的建議配置,對在部分網站,中型網站,配置:
<IfModule mpm_prefork_module>
StartServers 5 //預先起5個進程
MinSpareServers 5 //最小空閒進程
MaxSpareServers 10 //最大空閒進程
ServerLimit 1500 // 用於修改apache編程參數
MaxClients 1000 //併發鏈接數
MaxRequestsPerChild 0 //指一個進程裏能夠起多少個線程,對worker更好,0爲不限制
</IfModule>
若是你的網站pv值百萬,能夠這樣設置:
ServerLimit 2500 // 用於修改apache編程參數
MaxClients 2000 //併發鏈接數