4

Following advice, I've just added the following line to the catalina.bat file in my installation of tomcat 6.0.26:

set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=128m

I know that settings:

Xms128m -Xmx512m

Control the initial heap size and what it can exppand to. But what exactly is:

-XX:MaxPermSize=128m

Word from Tomcat themselves:

Following advice found elsewhere on the internet

Always to be taken with large chunks of salt.

set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=128m

You would be better off using CATALINA_OPTS, since setting JAVA_OPTS pointlessly affects the shutdown script as well as the startup one.

I know that settings: Xms128m -Xmx512m

Control the initial heap size and what it can expand to.

In a server environment, you normally want Xms and Xmx set to the same value to avoid heap thrashing. The exact size is completely dependent on what your webapps need.

But what exactly is: -XX:MaxPermSize=128m

It's the amount of space to which the so-called permanent generation can expand. PermGen holds primarily instances of java.lang.Class, so it only needs to be specified if you have a large number of classes in your environment.

Should it be set to an addition of the other settings, or the other settings to an addition of it?

What does that question mean? PermGen size is completely independent of the heap size.

Make sure you have enough RAM available on the system to support the Xmx + PermGen + a_lot_of_other_stuff. Monitor the system to make sure you're not getting into paging.

Community
  • 1
  • 1
Mr Morgan
  • 2,215
  • 15
  • 48
  • 78
  • 1
    **UPDATE:** The `PermGen` is gone in Java 8. See the article, [Java 8: From PermGen to Metaspace](http://java.dzone.com/articles/java-8-permgen-metaspace) by Pierre - Hugues Charbonneau. – Basil Bourque Apr 09 '15 at 19:46

1 Answers1

1

This post explains it better than I can. That size is the size of that permanent generation box in the article.

Also see here

Community
  • 1
  • 1
  • So should one be set to the addition of the others or not? – Mr Morgan Dec 09 '11 at 14:39
  • I've never changed it myself, when you read the list of things stored in it, I don't think that having more in your heap means more the perm gen heap. When you say you followed advice, I guess the question is how expert is the person who gave you that advice? – Claire Harding Dec 09 '11 at 14:43