What Tomcat JVM startup options are associated with memory?

I am trying to understand the fine tuning of the Tomcat memory settings. In this assignment, I have the following three questions:

  • What memory related JVM startup options are there when starting Tomcat? What for?
  • What is a good thumb rule for fine tuning memory settings for installing Tomcat?
  • How do you control the memory consumption of your current Tomcat installation?
+4
source share
4 answers
+1
source

What memory related JVM startup options are there when starting Tomcat? What for?

I would say that the answer depends on so many factors that it is impossible to give a general answer. For instance:

  • The memory options will largely depend on the behavior of the web applications you use in your Tomcat. Is a web memory puzzle? Is their memory usage cyclic? Does it depend on the load? Do they use / rely on caches in the heap?
  • Do you redirect your webpages regularly? Do webapps have tricks with class loaders?
  • Webapps have specific performance requirements; for example, should you complete 95% of the requests within a certain time?
  • Can you ignore the memory requirements of other Tomcat instances / other applications running on the same computer?

Your best strategy is to use JMX / jconsole / etc to see how the GC builds in your Tomcat instances. If you are unhappy with what you see, then consider setting up a GC.

(And read the related article in @Romain's answer!)

+2
source

Basically, most people configure -Xmx, which means memory reserved for the Java heap. If in the box where Tomcat is running, nothing else is running that eats RAM, and you do not do a lot of I / O (which is beneficial to use RAM as a cache), you should usually let Tomcat use as much memory as possible.

Past times since the last time I had to configure Tomcat, but it was more convenient to set up garbage collection.

Use any JMX management tool to monitor memory usage; JConsole comes with the JDK and is very useful.

+1
source

Two Java options to configure are: -Xmx and -Xms, which set the maximum available memory for the JVM and the original memory used by the JVM. The quick man java explain how to use -Xmx and -Xms. As always, more memory will help speed up the process.

0
source

Source: https://habr.com/ru/post/1312661/


All Articles