OpenJDK vs Java HotspotVM
Asked Answered
D

2

29

Are OpenJDK VM and Oracle Hotspot VM still two different JVMs?

I can't seem to find any somewhat official documentation on anything about OpenJDK VM. Even in OpenJDK homepage there is an HotSpot Group which develops HotSpot VM.

The HotSpot group is comprised of developers involved in the design, implementation, and maintanence of the HotSpot virtual machine

However if I check java -version on my Windows machine it prints out

Java HotSpot(TM) 64-Bit Server VM

But on my Ubuntu VPS

OpenJDK 64-Bit Server VM

If those are two different VMs what are the main differences between them? Do they have different runtime flag sets?

Dayfly answered 2/6, 2017 at 18:48 Comment(6)
Possible duplicate of Difference between JVM and HotSpot?Oxygen
This question was answered in 2014. Newest answer is from 2015 which points to wikipedia list of all JVM implementations. In wikipedia it says that OpenJDK as (JDK) contains HotSpot virtual machine. But I am looking for somewhat official document or article or anything except wikipedia.Dayfly
Openjdk is the open source foundation for Java. Oracle Java is openjdk rebranded with additional functionality.Mythicize
@ataurenis I'm not sure whether you being unsatisfied with the source changes anything about it being pretty much the same question. Additional answers could be added there too after all.Higher
There are some components which are not licenced for openjdk. Presumably openjdk either uses open source replacements or they're only used for features that are not part of the public API.Higher
Related: What is the reason to use OpenJDK?Grandniece
I
14

Oracle HotSpot JVM is based on OpenJDK HotSpot project. So, they are mostly the same VM, except that Oracle JVM has a few additional commercial features, mainly, Java Flight Recorder, Application Class Data Sharing and Cooperative Memory Management.

Runtime flags are almost the same for both VMs; see the complete list using

-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+PrintFlagsFinal

As of JDK 8u131, the only difference is in the following flags (absent in OpenJDK VM):

 bool EnableResourceManagementTLABCache         = true         {product}
 bool EnableSharedLookupCache                   = true         {product}
 bool FlightRecorder                            = false        {commercial}
ccstr FlightRecorderOptions                     =              {product}
 bool LogCommercialFeatures                     = false        {product}
ccstr MemoryRestriction                         = none         {commercial}
 bool ResourceManagement                        = false        {commercial}
 intx ResourceManagementSampleInterval          = -1           {commercial}
ccstr StartFlightRecording                      =              {commercial}
 bool TraceSharedLookupCache                    = false        {product}
 bool UnlockCommercialFeatures                 := true         {commercial}
 bool UseAppCDS                                 = false        {commercial}
Isotone answered 3/6, 2017 at 1:59 Comment(3)
If you're talking about commercial features and printing flags wouldn't adding make unlockcommercialfeatures make sense?Higher
If you don't mind, please have a look at this follow-up question.Kutz
Update: Oracle has open-sourced commercial features such as Java Flight Recorder and Mission Control, turning them over to the OpenJDK project. Oracle declared that their own Oracle-branded Java implementation will be at feature-parity with OpenJDK.Grandniece
G
55

tl;dr

The accepted Answer by apangin is now outdated.

For recent versions such as Java 11, the Oracle JDK product is virtually identical to the OpenJDK project. OpenJDK now includes Oracle's previous offerings: Java Flight Recorder, Java Mission Control, Application Class-Data Sharing, and ZGC.

To quote the Oracle.com blog:

From Java 11 forward, therefore, Oracle JDK builds and OpenJDK builds will be essentially identical.

Oracle JDK & OpenJDK converging

Oracle has made dramatic changes in the last couple years.

Oracle declared their intention to converge their branded Oracle JDK with OpenJDK to feature-parity. Both are based on the OpenJDK code base.

Towards that end, the formerly commercial tools sold by Oracle, Flight Recorder and Mission Control are now open-sourced and donated to the OpenJDK project. See this and this on the OpenJDK site.

Oracle and other members of the OpenJDK consortium have contributed yet more source code to make the OpenJDK code base entirely open-source and unencumbered by licenses other than the GNU GPL+linking exception.

Oracle has changed their licensing terms. The Oracle JDK branded product is no longer free-of-cost for use in production. Alternatively, you can get a free-of-cost distribution of OpenJDK from any of over half a dozen vendors, including one from Oracle. For all the details, see this vital white paper written by pillars of the Java community, Java Is Still Free.

I drew this flowchart to guide you in selecting a JDK source.

Flowchart guiding you in choosing a vendor for a Java 11 implementation

Oracle reserves the right to patch their own branded product for an urgent fix or security vulnerability. But the company has stated their intention to also contribute and coordinate with the other OpenJDK members. Oracle continues to own the Java trademarks and to lead the future of the Java platform. For the existing Long-Term Support (LTS) versions 8 and 11, Oracle has ceded stewardship to RedHat (IBM).

Motivations in choosing a vendor for Java

HotSpot versus OpenJ9

The Question here asks:

Are OpenJDK VM and Oracle Hotspot VM still two different JVMs?

As discussed above, the two products are converging at feature parity. Regarding HotSpot technology, read on.

HotSpot is one component within both Oracle JDK and OpenJDK, as discussed above. Today’s HotSpot also combines parts from JRockit. Oracle merged the best of both Java engines, having acquired them from Sun Microsystems and BEA Systems.

The Adoptium project (formerly known as AdoptOpenJDK) from the Eclipse Foundation also provides a build of OpenJDK using Eclipse OpenJ9 (based on J9, donated by IBM) as an alternative to HotSpot. When downloading from Adoptium web site, you choose either HotSpot or OpenJ9 from a menu.

Currently, tests seem to show OpenJ9 as dramatically faster to launch while using much less memory, but HotSpot may run faster with sustained usage. But this is still early days for OpenJ9, so investigate for yourself the latest developments.

Diagram showing history of HotSpot & JRockit merging, and OpenJ9 both available in Adoptium

Grandniece answered 22/5, 2019 at 0:1 Comment(1)
Great answer! Just wanted to add that the Eclipse Foundation got a TCK from Oracle for Adoptium. See projects.eclipse.org/proposals/eclipse-temurin-compliance.Thirtieth
I
14

Oracle HotSpot JVM is based on OpenJDK HotSpot project. So, they are mostly the same VM, except that Oracle JVM has a few additional commercial features, mainly, Java Flight Recorder, Application Class Data Sharing and Cooperative Memory Management.

Runtime flags are almost the same for both VMs; see the complete list using

-XX:+UnlockDiagnosticVMOptions -XX:+UnlockCommercialFeatures -XX:+PrintFlagsFinal

As of JDK 8u131, the only difference is in the following flags (absent in OpenJDK VM):

 bool EnableResourceManagementTLABCache         = true         {product}
 bool EnableSharedLookupCache                   = true         {product}
 bool FlightRecorder                            = false        {commercial}
ccstr FlightRecorderOptions                     =              {product}
 bool LogCommercialFeatures                     = false        {product}
ccstr MemoryRestriction                         = none         {commercial}
 bool ResourceManagement                        = false        {commercial}
 intx ResourceManagementSampleInterval          = -1           {commercial}
ccstr StartFlightRecording                      =              {commercial}
 bool TraceSharedLookupCache                    = false        {product}
 bool UnlockCommercialFeatures                 := true         {commercial}
 bool UseAppCDS                                 = false        {commercial}
Isotone answered 3/6, 2017 at 1:59 Comment(3)
If you're talking about commercial features and printing flags wouldn't adding make unlockcommercialfeatures make sense?Higher
If you don't mind, please have a look at this follow-up question.Kutz
Update: Oracle has open-sourced commercial features such as Java Flight Recorder and Mission Control, turning them over to the OpenJDK project. Oracle declared that their own Oracle-branded Java implementation will be at feature-parity with OpenJDK.Grandniece

© 2022 - 2024 — McMap. All rights reserved.