-1

I am trying to analyze the java application using VisualVM tool and am getting the following statistics. VisualVM screenshot.

What I don't understand is why my app is utilizing approx 100% of CPU, and what are the ways I can detect and resolve memory-related issues in java application.

The project is developed on Spring Boot and is deployed on Apache Tomcat Server.

Thanks.

Edit: My project used to utilize a max of 30% of CPU but now it's utilizing 100% and because of it most of the APIs are taking a lot of time to respond.

Kirat Kumar
  • 13
  • 1
  • 1
  • 6

1 Answers1

2

You could use a Profiling tool like JProfiler or VisualVM to analyze what your application is doing at that time. You could also connect a debugger and just "pause" the threads, that's a hack that may give you some hint on where to look for what is actually happening.

From your screenshot I'm not really seeing any memory specific issues, but using a profiling tool will also allow you to analyze which classes have instances with allocated memory.

Andreas Hartmann
  • 1,825
  • 4
  • 23
  • 36
  • You noticed that the screen dump is from VisualVM? – Thorbjørn Ravn Andersen Nov 19 '20 at 14:14
  • I am accepting this answer because I used VisualVM for profiling and it helped me to identify the problem. One of my API has a while loop which in certain conditions didn't exit and that while loop was using a lot of GPU. I simplely removed that code and now project is working properly. – Kirat Kumar Nov 21 '20 at 08:40