MPM(多路處理模塊),apache處理處理併發的三種方式
1、perfork:預處理模式
2、worker:工作模式
3、winnt:這個一般說是windows下采用的,也是一種worker模式。
一、apache如何設置
1、打開httpd.conf可以看到如下:
2、確定當前的apache的MPM模式
進入到apache/bin下,輸入命令http.exe -l即可查看
3、修改httpd-mpm.conf
<IfModule mpm_winnt_module>
ThreadsPerChild 150
MaxRequestsPerChild 0
</IfModule>
二、解釋幾個參數的意義
1、perfork:
<IfModule mpm_prefork_module>
StartServers 5 起始進程數
MinSpareServers 5 最小空閒進程
MaxSpareServers 10 最大空閒進程
MaxClients 150 關鍵值,併發量
MaxRequestsPerChild 0 意義不大,對worker影響大
</IfModule>
2、worker
<IfModule mpm_worker_module>
StartServers 2 起始進程
MaxClients 150併發數
MinSpareThreads 25 最小空閒線程
MaxSpareThreads 75 最大空閒線程
ThreadsPerChild 25 每個進程的線程數
MaxRequestsPerChild 0 設爲0,線程服務完,進程不死掉。
</IfModule>
單個apache的併發始終是有限的,還是要依靠負載均衡或Nginx反向代理!!