Configuring Tomcat Memory

If performance issues occur with Apache Tomcat, a common cause is a lack of Java Virtual Machine (JVM) memory allocation.  The default install of Apache Tomcat can be sufficient for a development environment or a small scale production environment, but as throughput increases with the use of Dekho, additional memory for Tomcat may need to be allocated to meet usage requirements.

Windows Task Manager/Resource Monitor will provide an indication of how much CPU and memory is being used by the Tomcat process.  However Java monitoring tools should be implemented to enable more accurate profiling of application performance and memory consumption.

http://www.dekho.com.au/wordpress/wp-content/uploads/2011/10/sampleVisualVM.png

Figure 9 - Real-time monitoring using VisualVM

With monitoring in place, alerts will be generated when memory usage approaches the maximum limit. Such alerts enable action to be taken to increase memory prior to a production environment impact.

 

 

For more details on setting up monitoring with VisualVM, please refer to this post on our Dekho Resource Center.

 

 

 

If monitoring is not in use, Tomcat could consume memory and begin causing ‘Out Of Memory Errors’ in the Dekho log files.  Dekho users may also report issues such as selections taking longer than usual to select, especially during peak capacity periods.

These errors are generated when there is no space in memory for the JVM to continue working.  There are two main causes for this issue:

§ Java heap space limitation.

§ Java perm gen limitation.


Configuring the Java Heap

Configuring the Java Permanent Generation (Permgen)