openj9
Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Top Related Projects
JDK main-line development https://openjdk.org/projects/jdk
Eclipse Temurin™ build scripts - common across all releases/versions
GraalVM CE binaires built by the GraalVM community
Alibaba Dragonwell8 JDK
Quick Overview
Eclipse OpenJ9 is an open-source Java Virtual Machine (JVM) optimized for cloud and server-side applications. It's designed to deliver excellent performance, fast startup times, and efficient memory usage, making it ideal for containerized and cloud-native environments.
Pros
- Significantly reduced memory footprint compared to other JVMs
- Faster startup times, especially beneficial for microservices and serverless applications
- Advanced garbage collection techniques for improved application responsiveness
- Extensive platform support, including x86, POWER, and z/OS
Cons
- Less widespread adoption compared to HotSpot JVM
- Some Java applications may require tweaking to fully leverage OpenJ9's optimizations
- Limited community support compared to more established JVMs
- Potential compatibility issues with certain Java libraries or frameworks
Code Examples
- Enabling OpenJ9-specific optimizations:
// Add this VM argument to enable AOT (Ahead-of-Time) compilation
-Xshareclasses:name=mycache,cacheDir=/path/to/cache
- Using OpenJ9's shared classes feature:
// Add these VM arguments to use shared classes
-Xshareclasses:name=mycache
-XX:SharedCacheHardLimit=200m
- Configuring OpenJ9's garbage collection policy:
// Use the balanced GC policy for server applications
-Xgcpolicy:balanced
Getting Started
To use OpenJ9 with your Java application:
- Download an OpenJ9-based JDK from AdoptOpenJDK or build it from source.
- Set the
JAVA_HOME
environment variable to point to the OpenJ9 JDK. - Run your Java application using the OpenJ9 JVM:
java -XX:+UseContainerSupport -XX:InitialRAMPercentage=70 -XX:MaxRAMPercentage=80 -jar your-application.jar
This command enables container support and sets initial and maximum heap sizes based on container memory limits.
Competitor Comparisons
JDK main-line development https://openjdk.org/projects/jdk
Pros of JDK
- Larger community and more widespread adoption, leading to better support and resources
- More comprehensive documentation and extensive ecosystem of tools and libraries
- Generally faster performance for short-running applications and quick startup times
Cons of JDK
- Higher memory footprint, especially for long-running applications
- Less optimized for cloud and containerized environments
- Slower performance for certain workloads, particularly those involving heavy garbage collection
Code Comparison
OpenJ9:
-XX:+UseContainerSupport
-XX:+IdleTuningGcOnIdle
-Xtune:virtualized
JDK:
-XX:+UseContainerSupport
-XX:+UseG1GC
-XX:+ExitOnOutOfMemoryError
OpenJ9 provides more out-of-the-box optimizations for containerized environments and idle resource management, while JDK offers different garbage collection options and error handling mechanisms.
Both projects are open-source Java implementations, but OpenJ9 focuses on performance optimizations for cloud and enterprise environments, while JDK aims to be a more general-purpose Java runtime. OpenJ9 typically excels in memory efficiency and long-running application performance, whereas JDK is often preferred for its widespread compatibility and ecosystem support.
Eclipse Temurin™ build scripts - common across all releases/versions
Pros of Temurin-build
- Broader platform support, including more architectures and operating systems
- More frequent releases and updates
- Extensive community involvement and contributions
Cons of Temurin-build
- Less focus on performance optimizations compared to OpenJ9
- May require more system resources for certain workloads
- Lacks some advanced features present in OpenJ9, such as ahead-of-time (AOT) compilation
Code Comparison
OpenJ9:
// Example of AOT compilation in OpenJ9
-Xshareclasses:name=MyCache
-Xscmx50M
-Xaot:forceAOT,count=1000,methods={java/lang/String.equals}
Temurin-build:
// Temurin-build doesn't have built-in AOT compilation
// It relies on standard HotSpot JIT compilation
-XX:+UseCompressedOops
-XX:+UseG1GC
The code comparison showcases OpenJ9's AOT compilation feature, which is not available in Temurin-build. Temurin-build, being based on HotSpot, relies on standard JIT compilation and garbage collection optimizations.
GraalVM CE binaires built by the GraalVM community
Pros of GraalVM CE Builds
- Supports multiple programming languages (Java, JavaScript, Python, Ruby, R, etc.)
- Offers ahead-of-time compilation for faster startup and lower memory footprint
- Provides native image generation for creating standalone executables
Cons of GraalVM CE Builds
- Larger download size and installation footprint
- Some compatibility issues with certain Java libraries and frameworks
- Steeper learning curve for advanced features like native image generation
Code Comparison
OpenJ9:
// Example of OpenJ9-specific JIT compiler directive
@com.ibm.jit.JITCompilerDirective({"option", "value"})
public void performOperation() {
// Method implementation
}
GraalVM CE Builds:
// Example of GraalVM-specific polyglot programming
import org.graalvm.polyglot.*;
Context context = Context.create("js");
Value result = context.eval("js", "2 + 3");
System.out.println(result.asInt()); // Outputs: 5
Both OpenJ9 and GraalVM CE Builds aim to improve Java performance, but they take different approaches. OpenJ9 focuses on optimizing the JVM itself, while GraalVM offers a more versatile ecosystem with support for multiple languages and ahead-of-time compilation. The choice between the two depends on specific project requirements and the desired balance between performance, flexibility, and ease of use.
Alibaba Dragonwell8 JDK
Pros of Dragonwell8
- Optimized for large-scale, high-performance Java applications
- Includes additional features like Coroutines and JWarmUp for improved performance
- Backed by Alibaba, providing enterprise-level support and regular updates
Cons of Dragonwell8
- Limited to Java 8, while OpenJ9 supports multiple Java versions
- Smaller community and ecosystem compared to OpenJ9
- Less extensive documentation and resources available for developers
Code Comparison
OpenJ9:
if (CompressedRefs::use32bitReferenceField()) {
return (U_32)(uintptr_t)heapBase;
} else {
return (uintptr_t)heapBase;
}
Dragonwell8:
if (UseCompressedOops) {
return (HeapWord*)(uintptr_t(addr) << LogMinObjAlignmentInBytes);
} else {
return (HeapWord*)addr;
}
Both examples show memory management techniques, but OpenJ9 uses a more explicit 32-bit reference check, while Dragonwell8 relies on the UseCompressedOops flag for object pointer compression.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Welcome to the Eclipse OpenJ9 repository
We're not sure which route you might have taken on your way here, but we're really pleased to see you! If you came directly from our website, you've probably already learned a lot about Eclipse OpenJ9 and how it fits in to the OpenJDK ecosystem. If you came via some other route, here are a few key links to get you started:
- Eclipse OpenJ9 website - Learn about this high performance, enterprise-grade Java Virtual Machine (JVM) and why we think you want to get involved in its development.
- Build instructions for JDK8, JDK11, and More - Here's how you can build an OpenJDK with OpenJ9 yourself.
If you're looking for ways to help out at the project (thanks!), we have:
If you're here to learn more about the project, read on ...
What is Eclipse OpenJ9?
Eclipse OpenJ9 is an independent implementation of a Java Virtual Machine. "Independent implementation" means it was built using the Java Virtual Machine specification without using any code from any other Java Virtual Machine.
The OpenJ9 JVM combines with the Java Class libraries from OpenJDK to create a complete JDK tuned for footprint, performance, and reliability that is well suited for cloud deployments.
The original source contribution to OpenJ9 came from the IBM "J9" JVM which has been used in production by thousands of Java applications for the last two decades. In September 2017, IBM completed open sourcing the J9 JVM as "Eclipse OpenJ9" at the Eclipse Foundation. Significant parts of J9 are also open source at the Eclipse OMR project. OpenJ9 has a permissive license (Apache License 2.0 or Eclipse Public License 2.0 with a secondary compatibility license for the OpenJDK project's GPLv2 license) that is designed to allow OpenJDK to be built with the OpenJ9 JVM. Please see our LICENSE file for more details.
Eclipse OpenJ9 is a source code project that can be built alongside Java class libraries. See the build instructions. Eclipse Foundation projects are not permitted to distribute, market or promote JDK binaries unless they have passed a Java SE Technology Compatibility Kit licensed from Oracle, to which the OpenJ9 project does not currently have access. See the Eclipse Adoptium Project Charter.
What is the goal of the project?
The long term goal of the Eclipse OpenJ9 project is to foster an open ecosystem of JVM developers that can collaborate and innovate with designers and developers of hardware platforms, operating systems, tools, and frameworks.
The project welcomes collaboration, embraces fresh innovation, and extends an opportunity to influence the development of OpenJ9 for the next generation of Java applications.
The Java community has benefited over its history from having multiple implementations of the JVM specification competing to provide the best runtime for your application. Whether adding compressed references, new Cloud features, AOT (ahead of time compilation), or straight up faster performance and lower memory use, the ecosystem has improved through that competition. Eclipse OpenJ9 aims to continue to spur innovation in the runtimes space.
How do I contribute?
Since we are an Eclipse Foundation project, each contributor needs to sign an Eclipse Contributor Agreement. The Eclipse Foundation operates under the Eclipse Code of Conduct to promote fairness, openness, and inclusion.
To get started, read our Contribution Guide.
If you think you want to contribute but you're not ready to sign the Eclipse Contributor Agreement, why not join our weekly updates in the #planning channel? We also have calls after a new release where you can learn more about how we work. We talk about new ideas, answer any questions that get raised, and discuss project plans and status. We also do lightning talks on features and functions of the VM. Visit the #planning channel in our Slack workspace for information about upcoming community calls and minutes from previous meetings (Join here).
What repos are part of the project?
- https://github.com/eclipse-openj9/openj9 : OpenJ9 main code base
- https://github.com/eclipse-openj9/openj9-omr : Eclipse OMR clone to stage temporary OMR changes. (None so far!)
- https://github.com/eclipse-openj9/openj9-systemtest : OpenJ9-specific system tests
- https://github.com/eclipse-openj9/openj9-website : OpenJ9 website repo
- https://github.com/eclipse-openj9/openj9-docs : OpenJ9 documentation repo
- https://github.com/eclipse-openj9/build-openj9 : OpenJ9 GitHub actions repo
- https://github.com/eclipse-openj9/openj9-utils : OpenJ9 utility programs / tools repo, a place to develop community around the tools
Where can I learn more?
- Moving to OpenJ9
- User documentation
- Many more resources are available on the OpenJ9 blog
Videos and Presentations
- JavaOne 2017: John Duimovich and Mike Milinkovich having fun chatting about Eclipse OpenJ9 (and EE4J)
- JavaOne 2017: Holly Cummins interviewing Dan Heidinga and Mark Stoodley on Eclipse OpenJ9 and OMR
- JavaOne 2017: Open sourcing the IBM J9 Java Virtual Machine
- JavaOne 2017: Eclipse OpenJ9 Under the hood of the next open source JVM
- JavaOne 2017: Ask the OpenJ9 Architects
- Eclipse OpenJ9 verbose JIT logs
- JavaOne 2017: How to build a debuggable runtime
- Reducing Garbage Collection pause times with Concurrent Scavenge and the Guarded Storage Facility
- How Concurrent Scavenge using the Guarded Storage Facility Works
- Are you still paying for unused memory when your Java app is idle?
- Under the hood of the Testarossa JIT Compiler
- Class sharing In Eclipse OpenJ9
Copyright IBM Corp. and others 2017
Top Related Projects
JDK main-line development https://openjdk.org/projects/jdk
Eclipse Temurin™ build scripts - common across all releases/versions
GraalVM CE binaires built by the GraalVM community
Alibaba Dragonwell8 JDK
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot