Our Meeho!™ Blog brings you general news, tech stuff, tips, inspiration and more in relation to the Meeho!™ platform.

Sign up now for free!

Posts from 5-2010

» Adjusting Apache Tomcat 6.x JVM memory footprint

Posted by Anders Østergaard Jensen on 5/5 2010 at 12:26 PM
We have previously covered how to properly adjust the JVM memory  size in the JBoss Application Server. For Apache Tomcat, the widely used Java EE web and application container, this requires a slightly different configuration. The configuration below applies to UNIX compatible systems only, but Windows should be very similar.
1. Open the bin/ directory of your Tomcat installation folder and create a new file called setenv.sh.
2. Edit the file and add the following two lines:
#!/bin/sh
export JAVA_OPTS=”-server -Xmx1024m”
The above line runs the JVM in a server configuration and sets the maximum memory usage to 1024 MB. Likewise for 512 MB it would be -Xmx512m.
3. Close your editor and make the file executable:
chmod +x setenv.sh
4. Finally, run setenv.sh every time before you run startup.sh from <tomcat-dir>/bin/. This will adjust the maximum memory footprint used by the JVM for Tomcat accordingly.
Remember that you can also add in other JVM options into this script as well.

We have previously covered how to properly adjust the JVM memory  size in the JBoss Application Server. For Apache Tomcat, the widely used Java EE web and application container, this requires a slightly different configuration. The configuration below applies to UNIX compatible systems only, but Windows should be very similar.

1. Open the bin/ directory of your Tomcat installation folder and create a new file called setenv.sh.

2. Edit the file and add the following two lines:

#!/bin/sh
export JAVA_OPTS="-server -Xmx1024m"

The above line runs the JVM in a server configuration and sets the maximum memory usage to 1024 MB. Likewise for 512 MB it would be -Xmx512m.

3. Close your editor and make the file executable:

chmod +x setenv.sh

4. Finally, run setenv.sh every time before you run startup.sh from <tomcat-dir>/bin/. This will adjust the maximum memory footprint used by the JVM for Tomcat accordingly.

Remember that you can also add in other JVM options into this script as well. Best of luck with your configuration endeavours.