JVM Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 4.10

What Is Class Data Sharing?

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

Last update: 2004.

Table of Contents

 About This Book

 Download and Install Java SE 1.6 Update 2

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

 ClassLoader Class - Class Loaders

 Class Class - Class Reflections

 Sun's JVM - Java HotSpot VM

 JRockit JVM 7.0 by BEA Systems

 JRockit JVM 8.0 by BEA Systems

 Memory Management Rules and Tests

 Garbage Collection Tests

 Stack Overflow Tests

 Thread Testing Program and Result

 StringBuffer Testing Program and Result

CDS (Class Data Sharing)

What Is Class Data Sharing?

 Regenerating Shared Archive

 Startup Time Saving with Restoring Shared Archive

 Startup Time Saving with Multiple JVM Processes

 Footprint Saving with Restoring Shared Archive

 Viewing Shared Memory of JVM Processes

 Micro Benchmark Runner and JVM Options

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

 Micro Benchmark Tests in JIT Compilation Mode

 Micro Benchmark Tests on "float" and "double" Operations

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2010
What Is Class Data Sharing?