Profiling a debug session

已回答

In my spring boot application I have some Java code that executes in under 2 minutes when running (using the green button Run 'MyApplication'), but takes almost 20 minutes when debugging (using the Debug 'MyApplication' button). Other code in my application takes almost the same amount of time in both configurations.

Both the affected and non-affected code uses parallel streams executing in ForkJoinPool.commonPool and does some heavy IO. The issue persists even with no breakpoints enabled.

My question is twofold: 1) what could be causing this, and 2) how can I figure out what's causing it? I.e. is there a way to profile a debug session? AFAICS none of the available profilers (IntelliJ Profiler, Async Profiler, Java Flight Recorder) allows to profile a "debug", only a "run".

0

Please see if https://intellij-support.jetbrains.com/hc/en-us/articles/206544799-Java-slow-performance-or-hangups-when-starting-debugger-and-stepping helps.

To attach a profiler to your application, you can try the following:

  • Run the app in debug mode.
  • Press Shift twice.
  • Type Attach Profiler to Process, press Enter, and select the needed process.
1

请先登录再写评论。