JVM Tutorials - Herong's Tutorial Examples - v5.13, by Herong Yang
Startup Time Comparison - OpenJ9 vs. HotSpot
This section provides a tutorial example on how to compare startup time of OpenJ9 and HotSpot JVMs. My tests show that OpenJ9 total execution time is much slower than HotSpot on a CentOS Linux computer.
OpenJ9 document also claims that OpenJ9 JVM startup time is 66% faster than HotSpot. Here is what I did to verify this on my CentOS computer.
1. Verify OpenJDK/HotSpot installation:
[herong$ java -version openjdk version "11.0.7" 2020-04-14 LTS OpenJDK Runtime Environment 18.9 (build 11.0.7+10-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+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, Hello.java, to test startup.
class Hello { public static void main(String[] a) { System.out.println("Hello world!"); } }
4. Run Hello.java with OpenJDK/HotSpot, and measure the total execution time, which includes startup time with a shell script
herong$ more run-HotSpot javac Hello.java time java Hello herong$ ./run-HotSpot Hello world! real 0m0.029s user 0m0.038s sys 0m0.008s
5. Run Hello.java with OpenJDK/OpenJ9, and measure the total execution time, which includes startup time with a shell script
herong$ more run-OpenJ9 ./jdk-14.0.1+7-jre/bin/javac Hello.java time ./jdk-14.0.1+7-jre/bin/java Hello herong$ ./run-OpenJ9 Hello world! real 0m0.090s user 0m0.071s sys 0m0.045s
6. Run Hello.java with OpenJDK/OpenJ9 with -Xquickstart, and measure the total execution time, which includes startup time with a shell script
herong$ more run-OpenJ9-quick ./jdk-14.0.1+7-jre/bin/javac Hello.java time ./jdk-14.0.1+7-jre/bin/java -Xquickstart Hello herong$ ./run-OpenJ9-quick Hello world! real 0m0.083s user 0m0.059s sys 0m0.046s
6. Compare test results:
Real User Sys Time Time Time ------- ------ ------ HotSpot 0.029s 0.038s 0.008s OpenJ9 0.090s 0.071s 0.045s % Slower 201% 87% 463% HotSpot 0.029s 0.038s 0.008s OpenJ9 w/ quickstart 0.083s 0.059s 0.046s % Slower 186% 55% 475%
My test shows that OpenJDK/OpenJ9 is much slower than OpenJDK/HotSpot. But mu measurements are total execution times that include JVM startup time, my program execution time, and JVM shutdown time. I can not conclude that OpenJDK/OpenJ9 startup time is slower than OpenJDK/HotSpot.
Table of Contents
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 Stack, Frame and Stack Overflow
Thread Testing Program and Result
CPU Impact of Multi-Thread Applications
I/O Impact of Multi-Thread Applications
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
Install OpenJ9 JVM with OpenJDK on CentOS Systems
Footprint Comparison - OpenJ9 vs. HotSpot
►Startup Time Comparison - OpenJ9 vs. HotSpot