聚沙成塔

web容器性能测试参数调整

上一篇 / 下一篇  2014-10-09 15:32:15 / 个人分类:性能测试

1、优化操作系统网络访问性能,调整以下参数:
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_tw_recycle=1
sysctl -w net.ipv4.tcp_fin_timeout=15
sysctl -w net.ipv4.tcp_keepalive_time=1800
sysctl -w net.core.wmem_max=16777216
sysctl -w net.core.rmem_max=16777216
sysctl -w net.ipv4.tcp_max_syn_backlog=8192
可通过sysctl -p查看配置是否生效
2、调整Linux系统的最大可打开文件数
echo -ne " 
* soft nofile 65535 
* hard nofile 65535 
" >>/etc/security/limits.conf
 调整为65536,即通过ulimit –n查看为65535
 3、修改tomcat/conf/server.xml中的maxThreads
 tomcat5.5
 <Connector port="8080" maxHttpHeaderSize="8192" maxThreads="500" minSpareThreads="25" maxSpareThreads="75" 
 enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true" 
 maxPostSize="10000"  allowTrace="false" />
tomcat6.0
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxThreads="500" />
4、修改/tomcat/conf/web.xml的超时时间(默认为30min)
 <session-config>
        <session-timeout>10</session-timeout>
    </session-config>
5、修改tomcat/bin/catalina.sh
tomcat5.5
CATALINA_OPTS="$CATALINA_OPTS -server -Xmx2g  -Xms2g -Xmn512M -Xss256k  -XX:PermSize=64M -XX:MaxPermSize=128M -XX:+UseAdaptiveSizePolicy -XX:ParallelGCThreads=8 -XX:MaxTenuringThreshold=5 -XX:+UseParallelGC  -XX:MaxGCPauseMillis=200 -XX:+PrintClassHistogram  -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/george/tomcat/logs"
tomcat6.0的session相比tomct5.5的session要消耗内存,为和tomcat5.5有相同的测试场景,相比tomcat5.5需要调大Xmx和Xms的值
CATALINA_OPTS="$CATALINA_OPTS -server -Xmx5g  -Xms5g -Xmn2g -Xss256k  -XX:PermSize=512M -XX:MaxPermSize=512M -XX:+UseAdaptiveSizePolicy -XX:ParallelGCThreads=8 -XX:MaxTenuringThreshold=5 -XX:+UseParallelGC  -XX:MaxGCPauseMillis=200 -XX:+PrintClassHistogram  -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/george/tomcat/logs"


TAG: 参数调整

 

评分:0

我来说两句

Open Toolbar