Footprint Comparison - OpenJ9 vs. HotSpot

This section provides a tutorial example on how to compare footprint of OpenJ9 and HotSpot JVMs. My tests show that OpenJ9 footprint is 28% smaller than HotSpot on a CentOS Linux computer.

OpenJ9 document claims that OpenJ9 JVM footprint (measured as RSS, Resident Set Size) is 66% smaller than HotSpot after startup. Here is what I did to verify this on my CentOS computer.

1. Verify OpenJDK/HotSpot installation:

herong$ java -version
openjdk version "11.0.6" 2020-01-14 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.6+10-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.6+10-LTS, mixed mode, sharing)

2. Verify OpenJDK/OpenJ9 installation:

herong$ ./jdk-14.0.1+7-jre/bin/java -version
openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (build 14.0.1+7)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.20.0, JRE 14 Linux ...
OpenJ9   - 05fa2d361
OMR      - d4365f371
JCL      - 5757187cae based on jdk-14.0.1+7)

3. Use a simple Java program,, to test footprint.

 * Copyright (c), All Rights Reserved.
class LongWhile {
   public static void main(String[] a) {
      Runtime rt = Runtime.getRuntime();
      System.out.println("Total memory: " + rt.totalMemory());
      System.out.println(" Free memory: " + rt.freeMemory());
      System.out.println(" Used memory: "
         + (rt.totalMemory()-rt.freeMemory()));
      while (true);

4. Run with OpenJDK/HotSpot, and measure RSS (Resident Set Size) of the JVM process in two terminal windows:

herong$ java
Total memory: 127926272
 Free memory: 120359424
 Used memory: 7566848

(on another window)
herong$ ps -ef | grep java
15799 15182 98 02:27 pts/0 ... java

[herong$ ps -orss --pid 15799

[herong$ kill 15799

5. Run with OpenJDK/OpenJ9, and measure RSS (Resident Set Size) of the JVM process in two terminal windows:

herong$ ./jdk-14.0.1+7-jre/bin/java
Total memory: 8912896
 Free memory: 2692152
 Used memory: 6220864

(on another window)
[herong$ ps -ef | grep java
15560 15182 99 04:18 pts/0  ... ./jdk-14.0.1+7-jre/bin/java

[herong$ ps -orss --pid 15560

[herong$ kill 15560

6. Compare test results:

               Used     RSS
             Memory    Size
            -------   -----
HotSpot     7566848   88556
OpenJ9      6220864   63728
% Smaller       18%     28%

Too bad. My test shows only 28%, not 66%, saving of RSS (Resident Set Size) when using OpenJDK/OpenJ9 instead of OpenJDK/HotSpot.

Table of Contents

 About This Book

 JVM (Java Virtual Machine) Specification

 Java HotSpot VM - JVM by Oracle/Sun

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

 ClassLoader Class - Class Loaders

 Class Class - Class Reflections

 JVM Runtime Data Areas

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

 CPU Impact of Multi-Thread Applications

 I/O Impact of Multi-Thread Applications

 CDS (Class Data Sharing)

 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

OpenJ9 by Eclipse Foundation

 What Is Eclipse OpenJ9

 Install OpenJ9 JVM with OpenJDK on CentOS Systems

Footprint Comparison - OpenJ9 vs. HotSpot

 Startup Time Comparison - OpenJ9 vs. HotSpot

 JRockit JVM 28.2.7 by Oracle Corporation

 Archived Tutorials


 Full Version in PDF/EPUB