This section describes what is Class Data Sharing (CDS) - Sharing common classes among multiple JVM processes.
What Is Class Data Sharing?
Class Data Sharing (CDS) is a new feature introduced in JDK 1.5.0.
CDS is designed to reduce the startup time and footprint of Java applications.
The basic idea of CDS is to:
Select a set of system classes that are commonly used by Java applications.
Load the selected classes into memory.
Dump the loaded classes to a file called a "shared archive".
When a subsequent Java application is launched, JVM will restore
the shared archive file into memory.
When multiple Java applications are launched on the machine, a portion of
the shared archive will be shared by multiple JVM processes.
The startup time is reduced because of restoring shared archive is much faster
than loading classes.
The footprint is reduced because of some data is shared by multiple JVM processes.
"java" command options related to CDS:
"-Xshare:dump" - Regenerating the shared archive file
"-Xshare:on" - Forcing JVM to restore the shared archive file
"-Xshare:off" - Forcing JVM to not use the shared archive file