What is the startup time in a Java virtual machine?

Sometimes I heard people discussing Java startup time. This seems to be an important aspect of performance. But what is it really?

  • What does it mean?
    • Class loading time caused by dynamic loading of classes?
    • Or is the first overhead compilation in the JVM just for compilation?
    • Or something else that causes “slowness” during the initial execution period of a Java program?

Then the second question:

  • How to measure startup time for Java programs? At what point in time is this time called start time?

I do not know if my question is asked correctly; if not, let me know. Thanks!

+7
source share
2 answers

Launch time is not formally defined. Indeed, most of the terms used in practical IT are not formally defined. (Or formal definitions are ignored.)

But roughly speaking, the time comes when the application starts, when it is ready to do something useful. What happens at startup depends on the application, but it involves loading the static class, initializing the static class, and (possibly) compiling the JIT of some classes. Other things may include starting user interfaces, connecting to databases, preloading application-specific data structures, wiring application, etc.

The problem with trying to define a “run time” formally is that any definition probably won't work for some significant subset of application types. And even if you can define it, there is a complication that some of the startup tasks (or warm-ups) may continue in the background after the application declares itself “ready”.

(This is not a Java problem. Consider the “startup” of a laptop, that is, what happens between turning your desktop on and off.)

How to measure startup time for Java programs? From what point to what point is the duration called launch time?

Both of these can decide, depending on the type of application you are talking about, and what you want to consider as the launch phase of your application.

+1
source

As mentioned in Stephen C, there is no general formal definition of “launch time”.

To get an intuitive understanding of this concept, I found some description on Oracle websites .

In principle, this gives an informal definition. “ Application startup time is the time it takes to launch and launch the application and is ready to start doing what it should do. ” Both the JVM and the application itself can influence the start of -up time.

In addition, this gives some idea (heap -Xms / -Xmx heap size adjustment ) to reduce startup time. Either too large or too small heap lengths extend the startup time.

Further, the JVM " Slow Start Diagnostics " shows some tips to find reasons for a slow start.

Note that this is all in the context of the JVockit JVM, but the ideas are more general.

+1
source

All Articles