环境:apache用的是prefork工作模式
一、Apache
1、编辑/etc/httpd/httpd.conf,去掉#注释
Include /etc/httpd//extra/httpd-mpm.conf
2、配置/etc/httpd/extra/httpd-mpm.conf
<IfModule mpm_prefork_module>
StartServers 5
MinSpareServers 5
MaxSpareServers 10
MaxClients 150
MaxRequestsPerChild 0
</IfModule>改为<IfModule mpm_prefork_module>
StartServers 30
MinSpareServers 30
MaxSpareServers 50
ServerLimit 25000
MaxClients 25000
MaxRequestsPerChild 3000
</IfModule>二、Tomcat
1.编辑tomcat/conf/server.xml
增加maxThreads,accptCount,maxSpareThreads
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="9009" protocol="AJP/1.3" redirectPort="8443" URIEncoding="UTF-8" maxThreads="4000" acceptCount="2000" maxSpareThreads="2000"/>

本文介绍如何通过调整Apache和Tomcat的配置参数来提升服务器性能。针对Apache使用prefork模式,修改了最大客户端连接数及子进程请求限制等;对于Tomcat,则增加了线程池的最大线程数等相关配置。
907

被折叠的 条评论
为什么被折叠?



