日期:2014-05-17  浏览次数:23230 次

apache2.2+tomcat5.5集群问题CPU100%,但是内存不增问题
服务器配置:
4核CPU 12G内存 window2003


Apache2.2.19
apache-tomcat-5.5
mod_jk-1.2.31-httpd-2.2.3.so


http.conf配置
---------------------------------
Include conf/mod_jk.conf
<IfModule mpm_winnt.c>
Win32DisableAcceptEx
ThreadsPerChild 1700
MaxRequestsPerChild 0
</IfModule>

HostnameLookups Off
MaxKeepAliveRequests 0
UseCanonicalName Off
AccessFileName .htaccess
---------------------------------

workers.properties配置
---------------------------------
worker.list = controller,tomcat1,tomcat2,tomcat3,tomcat4 #server 列表
#========tomcat1========
worker.tomcat1.port=8009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat1.host=localhost #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor = 1 #server的加权比重,值越高,分得的请求越多
#========tomcat2========
worker.tomcat2.port=9009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat2.host=localhost #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat2.type=ajp13
worker.tomcat2.lbfactor = 1 #server的加权比重,值越高,分得的请求越多
#========tomcat3========
worker.tomcat3.port=10009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat3.host=localhost #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat3.type=ajp13
worker.tomcat3.lbfactor = 1 #server的加权比重,值越高,分得的请求越多
#========tomcat4========
worker.tomcat4.port=11009 #ajp13 端口号,在tomcat下server.xml配置,默认8009
worker.tomcat4.host=localhost #tomcat的主机地址,如不为本机,请填写ip地址
worker.tomcat4.type=ajp13
worker.tomcat4.lbfactor = 1 #server的加权比重,值越高,分得的请求越多
#========controller,负载均衡控制器========
worker.controller.type=lb
worker.controller.balanced_workers=tomcat1,tomcat2,tomcat3,tomcat4 #指定分担请求的tomcat
worker.controller.sticky_session=true
---------------------------------
mod_jk.conf配置
---------------------------------
#加载mod_jk Module
LoadModule jk_module modules/mod_jk-1.2.31-httpd-2.2.3.so
#指定 workers.properties文件路径
JkWorkersFile conf/workers.properties
#指定那些请求交给tomcat处理,"controller"为在workers.propertise里指定的负载分配控制器
JkMount /*.jsp controller
JkMount /*.do controller
JkMount /*.* controller
JkMount /* controller
---------------------------------
tomcat5 server.xml关键集群代码配置 <Connector port="8009" 
  enableLookups="false" redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8"
  minSpareThreads="25" maxSpareThreads="2000" acceptCount="5000"
  maxThreads="2000" connectionTimeout="60000"/>

   
  <Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">  
  

   
  <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
  resourceName="UserDatabase"/>

  <Host name="localhost" appBase="webapps"
  unpackWARs="true" autoDeploy="true"
  xmlValidation="false" xmlNamespaceAware="false">

   
   
   
  <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"
  managerClassName="org.apache.catalina.cluster.session.DeltaManager"
  expireSessionsOnShutdown="false"
  useDirtyFlag="true"
  notifyListenersOnReplication="true">