以下是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)。