MilesWeb Hosting Forum

Web Hosting Technical Support => Tomcat Java Hosting => Topic started by: Manish on June 05, 2016, 02:27:54 PM

Title: How to Set or Increase Memory Heap Size in Apache Tomcat
Post by: Manish on June 05, 2016, 02:27:54 PM

If you wish to set or increase Heap size in apache tomcat on cpanel server (you can see the settings that are configurable if you issue “java -X” without the quotes), then create a file named /var/cpanel/tomcat.options. Add below entries in the file:


This would change the maximum Java heap size (Xmx) and the initial Java heap size (Xms) on startup.

After this has been done, Tomcat would need to be restarted from WHM:

Go to WHM » Restart Services » Servlet Server (Tomcat)

Once you restart tomcat it will show result as below:

Service Status
tomcat (jsvc.exec -user tomcat -cwd /usr/local/easy/share/easy-tomcat7 -pidfile /var/run/ -cp /usr/local/easy/bin/bootstrap.jar:/usr/local/easy/bin/tomcat-juli.jar:/usr/local/easy/share/java/commons-daemon.jar -Djava.endorsed.dirs=/usr/local/easy/share/easy-tomcat7/endorsed -outfile /var/log/easy-tomcat7/catalina.out -errfile /var/log/easy-tomcat7/catalina.err -verbose -Xmx2000M -Xms1000M org.apache.catalina.startup.Bootstrap start) running as 491 with PID 4437 (process table check method)

Startup Log
Adding in custom Tomcat option(s): -Xmx2000M
Adding in custom Tomcat option(s): -Xms1000M
Command '/usr/local/easy/bin/jsvc -user tomcat -cwd /usr/local/easy/share/easy-tomcat7 -pidfile /var/run/ -cp /usr/local/easy/bin/bootstrap.jar:/usr/local/easy/bin/tomcat-juli.jar:/usr/local/easy/share/java/commons-daemon.jar -Djava.endorsed.dirs=/usr/local/easy/share/easy-tomcat7/endorsed -outfile /var/log/easy-tomcat7/catalina.out -errfile /var/log/easy-tomcat7/catalina.err -verbose -Xmx2000M -Xms1000M org.apache.catalina.startup.Bootstrap start' returned: 0

tomcat started successfully.

That's all  :)