Tomcat配置优化要点

1、内存使用调整(Out of Memery问题)
Tomcat 默认可以使用的内存为 128MB ,在较大型的应用项目中,这点内存是不够的,需要调大。

   Windows 下,在文件 {tomcat_home}/bin/catalina.bat , Unix 下,在文件 {tomcat_home}/bin/catalina.sh 的前面,增加如下设置:

   JAVA_OPTS='-Xms 【初始化内存大小】 -Xmx 【可以使用的最大内存】 '

  需要把这个两个参数值调大。例如:

rem ----- Execute The Requested Command ---------------------------------------

set JAVA_OPTS='-Xms256m -Xmx512m'

 

  表示初始化内存为 256MB ,可以使用的最大内存为 512MB

 

2、连接线程数调整(cannot connect to server问题)

优化tomcat配置:maxThreads="500" minSpareThreads="400" maxSpareThreads="450"。但是tomcat 最多支持500个并发访问

 

3、connectionTimeout

单位是毫秒,Connector从接受连接到提交URI的等待的时间。

http://tomcat.apache.org/tomcat-5.5-doc/config/http.html
The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. The default value is 60000 (i.e. 60 seconds).

参考:
http://twotwoandapple.blogbus.com/logs/62770043.html


4、acceptCount

The maximum queue length for incoming connection requests when all possible request processing threads are in use. Any requests received when the queue is full will be refused. The default value is 100.
 


 

posted on 2010-11-10 16:53  preftest  阅读(3258)  评论(0编辑  收藏  举报

导航