File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes heap space setting for Tomcat on Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "heap space setting for Tomcat on Linux" Watch "heap space setting for Tomcat on Linux" New topic
Author

heap space setting for Tomcat on Linux

Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
i have read the other discussions on the same topic but none of them explains the procedure for linux environment. I have my tomcat and jdk on red hat linux. how can i set the heap space value? when i do it in JAVA_OPTS and restart the tomcat..nothing changes....please help....
Vlad Ilyushchenko
Greenhorn

Joined: Jan 26, 2006
Posts: 4
there are two jvm options for heap size:

-Xms and -Xmx

-Xms - is the minimum or initial size of your heap
-Xmx - is the maximim size

you set these parameters on java command line:

e.g.:

# java -Xmx128m -Xms128m com.mypackage.MyClass

the command above runs your class with java heap set to 128MB

Tomcat has its own startup script(s), which expect java command options to be in JAVA_OPTS environment variable. This is mainly because you dont have direct access to java command line when you run tomcat. So to run Tomcat with 256MB of heap you do something like:

# export JAVA_OPTS="-Xmx256m -Xms256m"
# ./startup.sh

In server environment you should keep -Xms and -Xms the same, unless you have specific reasons why not to allocate all memory from the beginning.

The realistic maximum heap size on 32bit linux is 1900m. You can push it up to 2000m but there is high risk of jvm crash.

On 64mit linux the maximum heap size is almost in all cases more then RAM you ever have.
Neeraj Macker
Ranch Hand

Joined: Nov 10, 2004
Posts: 77
thanks, but the JAVA_OPTS does not work. I added the CATALINA_OPTS in catalina.sh and now it works.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: heap space setting for Tomcat on Linux