Sometimes I heard people discussing about the start-up time for Java. It seems this is an important performance aspect. But what it really is?
- What does it compose of?
- Class loading time caused by dynamic class loading?
- Or first time compilation overhead in compile-only JVM?
- Or something else that causes the “slowness” during the beginning period of a Java program execution?
Then, the second question is
- how to measure the start-up time for Java programs? From which point to which point is the duration called start-up time?
I don’t know if my question is asked in the right way; if not, please let me know. Thanks!
The startup time is not formally defined. Indeed, most terms used in practical IT are not formally defined. (Or the formal definitions are ignored.)
But roughly speaking, it is the time from when the application is launched to when it is ready to do something useful. What goes on during startup is application dependent, but it includes static class loading, static class initialization and (possibly) JIT compilation of some of the classes. Other things might include starting UIs, connecting to databases, preloading application-specific data structures, application “wiring”, and so on.
The problem with trying to define “startup time” formally is that any definition is likely to not work for some significant subset of application types. And even when you can define it, there is the complication that some of the startup (or warmup) tasks may continue happening in the background after the application announces itself as “ready”.
(This is not a Java specific problem. Consider the “startup” of a laptop; i.e. what happens between powering it on and your desktop being fully usable.)
Both of those are up to you to decide, depending on the kind of application you are talking about, and what you want to consider as the startup phase for your application.