1.JVM内存配置 修改/bin/catalina.bat Xml代码
1. set _EXECJAVA=%_RUNJAVA% 2. set MAINCLASS=org.apache.catalina.startup.Bootstrap 3. set ACTION=start 4. set SECURITY_POLICY_FILE= 5. set DEBUG_OPTS= 6. set JPDA= 7. set JAVA_OPS=-Xms64m -Xmx128m 其中,-Xms:初始值,-Xmx:最大值,-Xmn:最小值
2.Tomcat线程池的配置
修改/conf/server.xml,去掉以下代码的注释 Xml代码
1. 其中, name
The name used to reference this pool in other places in server.xml. The name is required and must be unique.
这个是线程池的名字,必须唯一,后面的配置里有用. namePrefix
(String) The name prefix for each thread created by the executor. The thread name for an individual thread will be namePrefix+threadNumber
线程的名字前缀,用来标记线程名字的,这样每个线程就用这个前缀加上线程编号了,比如 catalina-exec-1 catalina-exec-2
maxThreads
(int) The max number of active threads in this pool, default is 200
允许的最大线程池里的线程数量,默认是200,大的并发应该设置的高一些,反正只是限制而已,不占用资源
minSpareThreads
(int) The minimum number of threads always kept alive, default is 25
最小的保持活跃的线程数量,默认是25.这个要根据负载情况自行调整了。太小了就影响反应速度,太大了白白占用资源。
maxIdleTime
(int) The number of milliseconds before an idle thread shutsdown, unless the number of active threads are less or equal to minSpareThreads. Default value is 60000(1 minute)
超过最小活跃线程数量的线程,如果空闲时间超过这个设置后,会被关别。默认是1分钟。
threadPriority
(int) The thread priority for threads in the executor, the default is Thread.NORM_PRIORITY 线程的等级。默认是Thread.NORM_PRIORITY
去掉以下代码的注释 Xml代码
1. 2. 3.
因篇幅问题不能全部显示,请点此查看更多更全内容