码迷,mamicode.com
首页 > 其他好文 > 详细

tomcat内存简单调优

时间:2018-07-17 18:08:49      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:设置   runtime   less   base   roc   top   jre   打开文件   lis   

1.linux下调节tomcat初始内存大小

linux下tomcat的运行文件为catalina.sh,打开文件,在文件靠近顶部找到“ JAVA_OPTS ”字样,在它后面添加如下内容即可

#   JAVA_OPTS       (Optional) Java runtime options used when any command
#                   is executed.
#                   Include here and not in CATALINA_OPTS all options, that
#                   should be used by Tomcat and also by the stop process,
#                   the version command etc.
#                   Most options should go into CATALINA_OPTS.
#
JAVA_OPTS="-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Xms700m -Xmx1024m -XX:NewSize=512m -XX:MaxNewSize=1024m -XX:PermSize=512m -XX:MaxPermSize=512m"
#   JAVA_ENDORSED_DIRS (Optional) Lists of of colon separated directories
#                   containing some jars in order to allow replacement of APIs
#                   created outside of the JCP (i.e. DOM and SAX from W3C).
#                   It can also be used to update the XML parser implementation.
#                   Defaults to $CATALINA_HOME/endorsed.

2.windows下调节tomcat初始内存大小

windows下tomcat的运行文件为catalina.bat,打开文件,在文件中部找到“rem ----- Execute The Requested Command -----”字样 ,在它后面添加如下内容即可

set "JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER%"

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

set JAVA_OPTS=%JAVA_OPTS% -server -Xms2048m -Xmx2048m -Xmn512m -XX:PermSize=400m -XX:MaxPermSize=700m

echo Using CATALINA_BASE:   "%CATALINA_BASE%"
echo Using CATALINA_HOME2:   "%CATALINA_HOME2%"
echo Using CATALINA_TMPDIR: "%CATALINA_TMPDIR%"
if ""%1"" == ""debug"" goto use_jdk
echo Using JRE_HOME:        "%JRE_HOME%"
goto java_dir_displayed
:use_jdk
echo Using JAVA_HOME:       "%JAVA_HOME%"
:java_dir_displayed
echo Using CLASSPATH:       "%CLASSPATH%"

需要注意的是上面各值的大小需要根据服务器本身的内存大小来设置

 

tomcat内存简单调优

标签:设置   runtime   less   base   roc   top   jre   打开文件   lis   

原文地址:https://www.cnblogs.com/hanmk/p/9324381.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!