1

I have Spring Java 8 application deployed in Tomcat 8 server with 64 GB and multi core processor.

Application designed for number of user doing small operation every day and large process are scheduled to run in night time when there is no user operation.

Sometimes application became slow and unresponsive, mainly in day time while user performing small operation. After server restart it became normal for few days.

My observation while application slowness are

  • There is no locked queries or session in DB side.
  • There is no errors at that time.
  • There is no OutofMemory or memory related exception at that time.
  • I have checked the JVM through jVisual, in that heap memory keep growing and class count also increasing massively.
  • I have tried clearing garbage manually, but no use.

JVM argument:

-Xms8g-Xmx16g-XX:+AggressiveOpts-XX:+UseConcMarkSweepGC

I have the heap dump of JVM while it was slow, but i don't know how to find which Class or Method or Thread which causing the server slowness,

Looking for suggestion to solve slowness.

user207421
  • 305,947
  • 44
  • 307
  • 483
Selvam M
  • 520
  • 4
  • 18
  • 2
    Just look at number of threads. Does it keep on growing as server runs. Enable Spring actuator endpoint and try to access `threaddump` endpoint. https://docs.spring.io/spring-boot/docs/current/actuator-api/html/ – vavasthi Feb 14 '19 at 07:05
  • @VinayAvasthi No increase in thread count, But have more number of sleeping and timed-wait threads. – Selvam M Feb 14 '19 at 07:10
  • 1
    Any specific reasons for using ConcMarkSweepGC? You should use G1GC(which is default in Java 8) for heap size > 8GB. It offers more predictable garbage collection pauses than the CMS collector : https://www.oracle.com/technetwork/tutorials/tutorials-1876574.html – Rahul Feb 14 '19 at 07:18
  • 1
    Do you have any APM like AppDynamices, Dynatrace configured? You can configure threshold for slow transactions in it and it will capture them. Then you can drill down and see what part of transaction is slow. – Rahul Feb 14 '19 at 07:20
  • @Rahul Thank you for APM suggestion, I had tried using Stackify APM before,but it increase normal process turnaround time (ex: one process took 25 sec without Stackify and 45 sec after including). After removing APM it became normal. – Selvam M Feb 14 '19 at 08:45
  • @VinayAvasthi My application is based on legacy spring framework not spring boot, Is it possible to use spring actuator in that? – Selvam M Feb 14 '19 at 09:05
  • 1
    I assume you are facing this issue in Prod environment. Then, you should try to reproduce this issue in test environment and troubleshoot/test your fix there. Try using G1GC instead of CMS and see if it provides any improvement. Use APM in test environment to find the bottleneck in the transactions. If you don't want to use APM, then you can add proper logs to your application and use them to trace the bottlenecks. – Rahul Feb 14 '19 at 09:22
  • I will try using G1GC instead of CMS, thanks for suggestion @Rahul – Selvam M Feb 14 '19 at 09:24
  • Hi you can use MAT (Memory Analyzer Tool - provided by Eclipse) to analyse your heap dump which gives you the which class\object occupying more memory...this link could help you https://stackoverflow.com/questions/54209349/java-how-do-i-find-out-which-class-or-method-uses-a-lot-of-memory/54285074#54285074 – Ramesh Subramanian Feb 14 '19 at 12:48

0 Answers0