-2

i am trying to debug why my spring boot application takes around 200-ms to respond to an API, and for subsequent hits of same API it takes around 10-ms. no caching is involved in API. I am using VisualVM and seems there is a CPU spike only for first time and no spike is observed for subsequent hits.

How can i get to know which functions took most time/intensive when i made the first API call.

Update: Why are Spring Rest services slow on the first request?

CPU Usage

Rajat Aggarwal
  • 392
  • 3
  • 16

2 Answers2

1

You can use build profiler in Intellij Idea and check the Flame Graph .

Flame Graph – a convenient way to visually assess the performance of various code paths and their share in overall CPU/memory usage

enter image description here

I'm not going to copy the whole docs, but check the Intellij Idea docs https://www.jetbrains.com/help/idea/read-the-profiling-report.html

Ice
  • 1,783
  • 4
  • 26
  • 52
0

what about Glowroot it's a very useful and good Java Agent, that will help you to find your problem

Andrei Lisa
  • 1,361
  • 3
  • 11