Adding more Ram to Tomcat - Headless Linux server

bjbechd
New Contributor

I was hoping to know if anyone can tell me how to give more RAM to tomcat on a headless linux server. I feel really stupid posting this since I am a CJA :(

1 ACCEPTED SOLUTION

nessts
Valued Contributor II

there are command line instructions, essentially you create this file /usr/local/jss/tomcat/bin/setenv.sh that contains or whatever memory options you want. I believe
JAVA_OPTS=" -Xmx2048M -XX:MaxPermSize=512M
and just restart tomcat

View solution in original post

11 REPLIES 11

nessts
Valued Contributor II

http://resources.jamfsoftware.com/documents/products/documentation/Casper-Suite-9.2-JSS-Installation-Guide-for-Linux.pdf

nessts
Valued Contributor II

look for the maximum PermGen

bjbechd
New Contributor

This is a headless Linux serve with no GUI. the java util won't work. I was looking for the file to edit

bjbechd
New Contributor

and we are still on 8.73

nessts
Valued Contributor II

there are command line instructions, essentially you create this file /usr/local/jss/tomcat/bin/setenv.sh that contains or whatever memory options you want. I believe
JAVA_OPTS=" -Xmx2048M -XX:MaxPermSize=512M
and just restart tomcat

franton
Valued Contributor III

@bjbechd The issue i've found is that the file to alter varies wildly depending on how you installed tomcat. The JAMF supplied installer, because it places tomcat in a different location, the file to be changed is in a completely different place than if you installed everything manually.

I've had some success altering the catalina.sh file in $CATALINA_HOME/bin/

mml7
New Contributor II

On 8.73/9.22, we used to modify the jamf.tomcat7 file found in /etc/init.d:

export JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xmx8192m -Xms8192m -XX:MaxPermSize=1024m"

Due to what appears to be a re-write of the jamf.tomcat7 script, on 9.24, we modify the catalina.sh file that's found in /usr/local/jss/tomcat/bin:

JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Xmx8192m -Xms8192m -XX:MaxPermSize=1024m"

Edit: This is on CentOS 6.4 and gives Tomcat 8GB of RAM (minimum and maximum) with 1GB of PermGen

nessts
Valued Contributor II

@mml7 if you read the first couple of paragraphs they ask that you create the setenv.sh instead so that your customizations live through upgrades...

bjbechd
New Contributor

Thanks everyone for the replies. I got it taken care of. It all was the setenv.sh file that did what I needed to do. Thanks!

Lutz
New Contributor

For sake of completeness, with Casper 9.4 on Ubuntu with the JSS manually installed I had to place the setenv.sh file at this path:

/usr/share/tomcat7/bin/setenv.sh

tlarkin
Honored Contributor

Hi Everyone,

I just wanted to chime in here and expand on what is being discussed here. There are three ways to set memory for Tomcat in Linux. You can modify the JAVA_OPTS in three places, the catalina.sh, the setenv.sh, and in the tomcat startup scripts (you can spawn the Tomcat process with JAVA_OPTS). The best practice via the Tomcat documentation is the setenv.sh. All three ways accomplish the same goal, but the setenv.sh is not present by default. You must create it. Ideally, if you are managing multiple Tomcats, you wouldn't have to touch any config files and you can just drop the setenv.sh file in your Tomcat home folder, and be done with it, and it will scale better since Tomcat does not modify/deploy a new setenv.sh file during any upgrades or migrations.

Thanks,
Tom