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?
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}
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.
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).
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 AdoptOpenJDK project also provides a build of OpenJDK using Eclipse OpenJ9 (based on J9, donated by IBM) as an alternative to HotSpot. When downloading from AdoptOpenJDK 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.
来源:https://stackoverflow.com/questions/44335605/openjdk-vs-java-hotspotvm