Standalone tomcat 9 increases processor efficiency by up to 50% every 10 seconds while my web application is down

I am using Tomcat 9.0.0.M22 with jdk1.8.0_131 on Windows Server 2012 R2, and I have deployed the Spring Boot web application, the problem is that every 10 seconds the commons service daemon starts, increases the processor speed up to 50%, although my deployed web application is idle, then it decreases to 0%, and this behavior continues to occur every 10 seconds.

In my application, I don’t have any work that runs every 10 seconds, and also when I run my Tomcat web application from Eclipse, I don’t notice the same behavior, so I assume this is a Tomcat built-in thread.

+5
source share
4 answers
  • do a series of thread dumps as soon as the processor load spikes
  • you can use jdk/bin/jvisualvm to connect to your tomcat and repeatedly press the thread dump button in the upper right part of the thread tab or if you prefer the command line (for example, via script), you can also use jdk/bin/jcmd <pid-of-your-tomcat> Thread.Print >> dumps.txt
  • each dump shows all currently existing threads and a stack trace for each thread indicating that it is running
  • this should give you some tips that are related to making this download.
+1
source

Without additional information, this is just a guess, but it may be a garbage collector who tries to do this every ten seconds, but cannot evict any items because they are still needed. You can try to increase memory for Tomcat (-Xmx).

0
source

With such information, it’s quite difficult, a couple of points that you might think about:

  • As @jorg noted, you can take thread dumps that will give you an understanding of any blocking threads.
  • You said that it works fine on the local system, this does not necessarily mean that the code is optimal for the server platform. Dual control configurations, maxThreads, etc.
  • Optimize the JVM server by eliminating unnecessary garbage collection. Running a JVM with a higher maximum heap memory (-Xmx) will reduce the frequency at which garbage collection occurs.
  • Existing monitoring tools can use your analysis ( jVisualVM ).
0
source

I managed to completely stop this behavior by setting reloadable = "false" in context.xml.

0
source

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


All Articles