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?

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 usageI'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