Tomcat memory consumption

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

  • Should tomcat directly consume 2 GB from the OS?
  • If not, how much is needed?
  • If the memory is occupied by tomcat less than 2 GB, is this 2 GB of memory allocated by os for this tomcat, is it used only for this, or can some application use this memory?
  • and finally, we set this maximum and minimum memory, means that the OS allocates all the memory for tomcat?
+4
source share
1 answer

The JVM will -Xms any memory specified for -Xms . Thus, it will request and allocate 2 GB of memory at startup. If later more memory is required (up to -Xmx ), the JVM will request more memory from the OS.

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

Note: The preferred method for setting JVM parameters is JAVA_OPTS in setenv.sh rather than catalina.sh.

+8
source

All Articles