Limit tomcat heap memory usage on cPanel Server

To limit tomcat heap memory usage we normally change the environment variables in tomcat startup scripts. cPanel allows us to take care of this by creating and adding min and max values to a file called  /var/cpanel/tomcat.options (File won’t exist by default).

-Xmx200M
-Xms100M

the “-Xms” initial Java heap size for the application to 100MB, and the “-Xmx” maximum Java heap size to 200MB. If the – is not placed in front of the option when putting the values into /var/cpanel/tomcat.options file that is created, then Tomcat will refuse to startup properly.

This method would be preferred over directly editing /usr/sbin/starttomcat. The /var/cpanel/tomcat.options file would not be edited by cPanel scripts or upon updates.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>