OpenJDK vs Java HotspotVM

15,701

Solution 1

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}

Solution 2

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

Share:
15,701

Related videos on Youtube

arvist
Author by

arvist

Updated on September 15, 2022

Comments

  • arvist
    arvist over 1 year

    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?

    • Dmitriy
      Dmitriy almost 7 years
      Possible duplicate of Difference between JVM and HotSpot?
    • arvist
      arvist almost 7 years
      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.
    • matbrgz
      matbrgz almost 7 years
      Openjdk is the open source foundation for Java. Oracle Java is openjdk rebranded with additional functionality.
    • the8472
      the8472 almost 7 years
      @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.
    • the8472
      the8472 almost 7 years
      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.
    • Basil Bourque
      Basil Bourque over 4 years
  • the8472
    the8472 almost 7 years
    If you're talking about commercial features and printing flags wouldn't adding make unlockcommercialfeatures make sense?
  • einpoklum
    einpoklum over 5 years
    If you don't mind, please have a look at this follow-up question.
  • Basil Bourque
    Basil Bourque over 4 years
    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.
  • Alejandro Duarte
    Alejandro Duarte almost 3 years
    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.