Friday, March 5, 2010

How to change Tomcat memory settings

Apache Tomcat comes out of the box with a default configuration that uses just a small amount of memory (64MB). As you can easily imagine, that could not be enough in many situations. If you are using Tomcat as a service on Windows you can easily punch in some parameters that will ease your life using a graphical interface that can be accessed from the Start menu:

This will display the following form:

To increase the PermGen space, i.e. the memory area in which compiled code is stored, you have to add the parameter -XX:MaxPermSize in the Java Options section (I have used 256MB). Switching our attention to Heap space, Initial memory pool and Maximum memory pool, just like the Thread stack size, have a field of their own.

Of course the same parameters can be applied from the command line, which is what you most likely are using if you run your Tomcat on a different OS... if this is the case I'm sure you don't need me to write the detailed procedure here as you probably know it like the back of your hand ;-)

No comments: