Apache2.4已经默认event加载方式,然而我们需要进行优化,以提高效率
mpm event的配置如下
<IfModule mpm_event_module> StartServers 4 #默认启动进程数 MinSpareThreads 16 #最小线程 MaxSpareThreads 512 #最大线程 ThreadsPerChild 64 #最大子线程数 ServerLimit 32 #进程最大数 MaxRequestWorkers 2048 #最大请求数量 MaxConnectionsPerChild 10000 #最大连接次数,超过后释放线程 </IfModule>
想要优化,必须依照下面的计算公式
MaxSpareThreads > StartServers * ThreadsPerChild MaxRequestWorkers = ServerLimit * ThreadsPerChild
mpm-event依据上面的公式,根据你自己的情况进行修改即可。
修改后记得重启httpd
ServerLimit 400
ThreadLimit 8000
StartServers 250
MinSpareThreads 5000
MaxSpareThreads 8000
ThreadsPerChild 20
MaxRequestWorkers 8000
MaxConnectionsPerChild 200
《“优化Apache2.4的mpm event参数以提升内存利用率”》 有 1 条评论
I dont think Ive scan anything like this before. So good to find somebody with some original thoughts on this subject. thank for starting this up. This website is something that is needed on the web, someone with a little originality. Good job for bringing something new to the internet! Robenia Carlos Eduardo