Tomcat 6 Heap Size - Is this correct?

杀马特。学长 韩版系。学妹 提交于 2019-12-09 07:11:20

问题


I am running multiple tomcats on a Red Hat box and I would like to configure separate heap size for each of them (some instances use more memory).

Can I set the heap size min/max bt entering the following into the catalina.sh file:

CATALINA_OPTS="-Xms64m -Xmx256m"

Do I need add 'export'? i.e. export CATALINA_OPTS="-Xms64m -Xmx256m"


回答1:


Best practice is to put the setting of environment variables in a file named setenv.sh/.bat in the bin folder.

The catalina.sh script has logic to call into this script, if it exists.

The reason why this is recommended is because it makes setting of environment variables needed for your installation portable: you can easily copy setenv.sh to other Tomcat installations, you can upgrade Tomcat to a newer version (which might overwrite catalina.sh) but still have your existing setenv.sh.

An example on how to set the heap size inside setenv.sh:

export JAVA_OPTS='-Xmx784M` 



回答2:


If you add this to anything in the Tomcat installation, it will affect all instances run on that machine.

I think you want to set JAVA_OPTS separately, in separate scripts, which each then invoke Tomcat's startup script. The scripts can set different heap sizes. Yes, you need to export.



来源:https://stackoverflow.com/questions/2144037/tomcat-6-heap-size-is-this-correct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!