Forum: 

Cannot change java heap size allocation for tomcat

Linoan's picture

 

I have a web app that eats a little above 512mb.

> echo $CATALINA_OPTS
-server -Xms384M -Xmx512M -XX:MaxPermSize=256M

I tried increasing this but it does not reflect anything...

export CATALINA_OPTS = "-server -Xms1024M -Xmx1024M -XX:MaxPermSize=256M"
> echo $CATALINA_OPTS
-server -Xms384M -Xmx512M -XX:MaxPermSize=256M

How to change this settings? Is there some kinda override in our turnkey tomcat installation?

Adrian Moya's picture

I don't have this appliance at hand, but configuration of these parameters are always set in a file. In tomcat 6 is /etc/default/tomcat6 but I suppose you're using tomcat5, so look for something like /etc/tomcat5/*. Look for the configuration file and where it says JAVA_OPTS= there's where you have to make the change. That way is going to be a permanent change even if you boot your VM.

Also try not leaving spaces between CATALINA_OPTS and the values:

export CATALINA_OPTS="-server -Xms1024M -Xmx1024M -XX:MaxPermSize=256M"

Sorry if it's too late for this info. 

Adrian Moya's picture

Seems to be /etc/default/tomcat5.5 

Edit your file with "nano /etc/default/tomcat5.5" Ctrl+O to save and ctrl+x to quit. Ctrl+W to search for "JAVA_OPTS".

Check your current JAVA_OPTS and you can add lines like this at the end:

JAVA_OPTS="${JAVA_OPTS} -Xms1024m -Xmx1024m"

Hope it helps...

Linoan's picture

This is great! It is a little late but this info is really handy and helpful in the future.

I am a bit unfamiliar with turnkey but on my Ubuntu environment I always export these parameters.

Thank you very much. This is very much appreciated.

Regards!


Post new comment