0

I'm a newbie in profiling (but not in Java in general though), I interested Java or Kotlin profiling best practices.

I read multiple articles, watch some videos. I got profiling could be done either manually ( e.g. timestampEnd-timestampStart) or by using standart profiling tools (i'm writing here only that which included into JDK)

At the articles described how to use the tools, but never the best practice from end to end.

So my question is: yes, the tools are showing at real time what is happening. But do a programmer need to sit and watch to it for days to catch the moment when the program starts to mess up? AFAIK the process should be opposite: the program is working well as long as it can but the moment of getting trouble should be caught and logged automatically, then alerted to programmers and analysed by them, isn't it? So how the real time profiling tools provides it? What is the best practice?

(My question looks general, may be after it's answered I'll learn more about profiling using the answer and be more specific)

J.J. Beam
  • 2,612
  • 2
  • 26
  • 55

1 Answers1

1

This is pretty much what JFR was built to help solve. Having structured way to record various events and metrics from the JVM/JDK/Java Application in a repository that can be retrieved as self-describing binary files. So your production JVM can be run with a low-overhead configuration for JFR that contains detailed information about what happened in the application while you have some light-weight metrics with some monitors continually checking them and alerting you if something has happened. Then you'd just download the JFR profile and investigate what happened.