This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

I'm not using linux, so I don't know anything about the way you start Tomcat - probably using "startup.sh" script? If so, then take a look at the "catalina.sh" script - it is script that is being used by "startup.sh" and it is starting tomcat. In this script you can define java options using CATALINA_OPTS or JAVA_OPTS environment variables. Again, I'm not using linux, so I don't know how you define environment variable, but in windows you would do something like this:

Code:

set CATALINA_OPTS="-Xms256m -Xmx512m"

You would normally put environment variable definition at the beginning of your catalina script. Hope this helps.

Comment

yes, in catalina.sh i see both variables, but wondered what would be the difference between them (only the word stop for JAVA_OPTS )

I'm not sure, but I would assume that JAVA_OPTS variable is used by all JVM (something like global JVM settings?), and CATALINA_OPTS just by tomcat's.

On the side note, be careful about setting heap sizes - in this case the bigger is not always the better. Large initial heap sizes will increase the work the garbage collector has to do with each run, which can impact application performance. Heap size should be set accordingly to your application needs, memory allocation and usage.

I'm not sure, but I would assume that JAVA_OPTS variable is used by all JVM (something like global JVM settings?), and CATALINA_OPTS just by tomcat's.

thats better for JAVA_OPTS in the same catalina.sh, now all works fine

On the side note, be careful about setting heap sizes - in this case the bigger is not always the better. Large initial heap sizes will increase the work the garbage collector has to do with each run, which can impact application performance. Heap size should be set accordingly to your application needs, memory allocation and usage.

thanks for the advice, usually for intial heap i use 128MB and for the filed 999MB
(i have 2-3 gb ram in 2 machines)