Ahead-of-time class loading proposal would speed Java startups



Motivating the proposal is the desire to preserve the dynamism of the Java platform while reducing the cost of that dynamism, which must be paid every time an application starts, the proposal says. The highly dynamic Java platform has features such as dynamic class loading, dynamic linkage, and dynamic reflection, which give expressive power to developers. Java developers can, for example, write libraries that dynamically load and then link to plug-in components at run time, or assemble applications by composing libraries that dynamically link to other libraries. However, all that dynamism comes at a price, meaning the JVM does a lot of work during the startup of a typical server application, such as scanning JAR files on disk and loading parsed data into class objects. And it does this work on demand, lazily, just in time. As a result, a large server application may require seconds or even minutes to start up.

The key to improving startup time is to do some of this work ahead of time, rather than just in time. A specific goal of the proposal is improving startup time by exploiting the fact that most applications start up in roughly the same way every time they run. Other goals include:

  • Not requiring any changes to the code applications, libraries or frameworks.
  • Not requiring any change to how applications are started from the command line with the Java launcher, beyond the command-line options related directly to this feature.
  • Not requiring the use of the jlink or jpackage tools.
  • Laying a foundation for continued improvements to startup time and also to warmup time, i.e., the time needed for the HotSpot JVM to optimize an application’s code for peak performance.

The ahead-of-time proposal for class-loading and linking follows a previous proposal for ahead-of-time compilation for the JVM. That proposal is listed as being in draft status.  

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img