问题:并发一直上不去。求大神指点。
测试机环境:Red hat6.3 IBM 8G 内存 4核处理器
主要配置清单:
httpd-mpm.conf
<IfModule mpm_prefork_module>
ServerLimit 4000
StartServers 128
MinSpareServers 128
MaxSpareServers 256
MaxClients 4000
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_worker_module>
StartServers 5
ServerLimit 20
ThreadLimit 200
MaxClients 4000
MinSpareThreads 25
MaxSpareThreads 250
ThreadsPerChild 200
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_beos_module>
StartThreads 10
MaxClients 50
MaxRequestsPerThread 10000
</IfModule>
<IfModule mpm_netware_module>
ThreadStackSize 65536
StartThreads 250
MinSpareThreads 25
MaxSpareThreads 250
MaxThreads 1000
MaxRequestsPerChild 0
MaxMemFree 100
</IfModule>
<IfModule mpm_mpmt_os2_module>
StartServers 2
MinSpareThreads 5
MaxSpareThreads 10
MaxRequestsPerChild 0
</IfModule>
<IfModule mpm_winnt_module>
ThreadsPerChild 2000
MaxRequestsPerChild 0
</IfModule>
workers.properties
worker.list = controller,tomcat1,tomcat2,tomcat3
#========tomcat1========
worker.tomcat1.port=7009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat1.host=192.168.45.33 #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor = 1 #server的加权比重,值越高,分得的请求越多
#========tomcat2========
worker.tomcat2.port=6009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat2.host=192.168.45.33 #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor = 1 #server的加权比重,值越高,分得的请求越多
#========tomcat3========
worker.tomcat3.port=5009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat3.host=192.168.45.33 #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat3.type=ajp13
worker.tomcat3.lbfactor = 1 #server的加权比重,值越高,分得的请求越多
#========controller,负载均衡控制器========
worker.controller.type=lb
worker.controller.balance_workers=tomcat1,tomcat2,tomcat3 #指定分担请求的tomcat,旧版本中的balanced_workers,已不再推荐使用!
worker.controller.sticky_session=1 #sticky_session为1表示,
httpd.conf
LoadModule jk_module modules/mod_jk.so
JkLogFile /var/log/mod_jk.log
JkShmFile logs/mod_jk.shm
JkLogLevel info
JkWorkersFile conf/workers.properties
JkMount /* controller
server.xml
<Executor name="tomcatThreadPools" namePrefix="catalina-exec-"
maxThreads="1000" minSpareThreads="20" maxIdleTime="15000" />
<Connector executor="tomcatThreadPools"
port="6080" protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="60000"
keepAliveTimeout="15000"
minProcessors="100"
maxProcessors="1000"
maxThreads="1000"
minSpareThreads="100"
maxSpareThreads="500"
maxKeepAliveRequests="1"
redirectPort="6443"
maxHttpHeaderSize="8192" URIEncoding="UTF-8" enableLookups="false" acceptCount="1000" disableUploadTimeout="true"/>
<Connector executor="tomcatThreadPools"
keepAliveTimeout="15000"
maxThreads="1000"
minSpareThreads="100"
maxSpareThreads="500"
acceptCount="1000"
connectionTimeout="20000"
maxKeepAliveRequests="1" port="6009" protocol="AJP/1.3" redirectPort="6443" />
tomcat启动内存
JAVA_OPTS="-XX:PermSize=64M -XX:MaxPermSize=128m -Xms1024m -Xmx1024m -Duser.timezone=Asia/Shanghai"
测试结果:
Apache+单个tomcat 静态页面 : 并发 1500 请求转发:1500
apache+两个tomcat 静态页面: 并发2300 请求转发: 1800
apache+三个tomcat静态页面: 并发2300 请求转发:1900
你有几台测试客户机?
1台客户机、
@java_is_what: 你再增加一台测试客户机。
@Launcher: 嗯。好。我现在去试试。
@java_is_what: 增加了一台客户机,静态页面并发能到4500.请求转发能到2800.
@java_is_what: 你可以再适当的多增加几台测试客户机,每台客户机的并发请求数据适当减少点。注意服务器CPU和带宽占用。
有空也去研究研究