Java12 new features - default generated class data sharing (CDS) archive

The default generated class data sharing (CDS) archive

At the same physical machine a plurality of the JVM startup / virtual machines, each virtual machine if the load all the classes they need separate, startup costs, and the
memory occupancy is relatively high. So Java class team introduced data sharing mechanism (Class Data Sharing, referred to as CDS) concept, by some core classes shared between each JVM, each JVM only need to load their own applications to class. Benefits are: reduced start-up time, the other core classes is shared, so the JVM memory footprint is also reduced.

historic version
  • JDK5 introduction of the Class-Data Sharing can be used for multiple JVM share class, enhance boot speed, the first and only support system classes
    serial GC.

  • JDK9 be extended to support application classes and other GC algorithm.

  • New features java10 the JEP 310: Application Class-Data Sharing extends the Class-Data Sharing JDK5 introduced to support the
    application of Class-Data Sharing and open it (formerly commercial feature)

    • CDS 只能作用于 BootClassLoader 加载的类,不能作用于 AppClassLoader 或者自定义的 ClassLoader加载的类。在 Java 10 中,则将 CDS 扩展为 AppCDS,顾名思义,AppCDS 不止能够作用于
      BootClassLoader up, AppClassLoader and custom ClassLoader also be able to work, greatly increased the CDS of appropriate
      use range. Also it said that the development of custom classes can also be loaded to multiple JVM shared.
  • JDK11 will -Xshare: off change to the default -Xshare: auto, more convenient to use CDS features.

Iterative effect

Since Java 8, CDS carried out on the basic functions of a number of enhancements, improvements, enable the startup time and memory footprint significantly after application of CDS
decreased. Use an earlier version of Java 11 run HelloWorld on 64-bit Linux platforms tested, the test results show start time by 32%, while in the other 64-bit platforms, have similar or higher starting performance.

Java12 new features

Before JDK 12, CDS users want to take advantage of, even if only a list of default classes provided in the JDK, must java -Xshare: dump as an extra step to run.
JDK for Java 12 were in the process of building a 64-bit platform enhancements improved to make it the default generated class data sharing (CDS) archives, in order to achieve further improvement in startup time of the application, while avoiding the need to manually run: java - Xshare: the need to dump, JDK modified to facilitate the use of the $ {JAVA_HOME} / lib / server generates a directory named classes.jsa default archive file (about 18M).
Of course, if desired, you can also add other GC parameters to adjust the heap size, in order to obtain a better distribution of memory, but users can also create a CDS as a custom archive file as before.

Guess you like

Origin www.cnblogs.com/androidsuperman/p/11742837.html