ajduke
ajduke

Reputation: 5057

Tomcat Memory Consumption

I am going to install Tomcat on linux with JVM Heap size as 2048m(2GB) to 2304m(2GB+256MB) by setting CATALINA_OPTS="-Xms2048m -Xmx2304m" in cataina.sh file and the Linux OS have 8GB of the RAM so i am making some points , please help with this

Upvotes: 4

Views: 21793

Answers (1)

AngerClown
AngerClown

Reputation: 6229

The JVM will pre-allocate whatever memory you specify for -Xms. So, it will request and allocate 2GB of memory at startup. If it needs more memory later (up to -Xmx), the JVM will request more memory from the OS.

But, do you know you need this much memory? The main driver of memory consumption will be your application, not Tomcat. Simple webapps with a few servlets or JSPs can easily run in less than 32MB of heap. You need to measure your application for performance / load to determine the optimal setting.

A side note - the preferred method for setting JVM parameters is with the JAVA_OPTS setting in setenv.sh, not catalina.sh.

Upvotes: 8

Related Questions