以下是Tomcat在CentOS中的性能調優技巧:
/etc/security/limits.conf
,設置* soft nofile 65536
和* hard nofile 65536
。/etc/sysctl.conf
,添加net.core.somaxconn 65535
、net.ipv4.tcp_tw_reuse 1
等參數。/etc/rc.local
,添加echo never /sys/kernel/mm/transparent_hugepage/enabled
等命令。conf/server.xml
中配置Executor
,合理設置maxThreads
、minSpareThreads
等參數。Connector
協議改為org.apache.coyote.http11.Http11NioProtocol
。Connector
中添加compression="on"
。-Xms
、-Xmx
等參數,選擇合適的垃圾回收器(如G1)。