10

Oracle has recently decided to start charging for commercial use of their JVM.

Our team has started to switch over to using OpenJDK instead, and are finding everything seems to be working fine, except we're getting slower performance.

Our servers are linux servers, and according to our performance team,

We have observed significant slowness on most java calls. We reviewed the logs and investigated a few of the calls, and we are not seeing any exceptions or errors, just slowness.

Does anyone else have any data on whether or not this is true, that OpenJDK is on average slower than the Oracle JVM ?

ANSWER: For us, the issue was determined to be something to do with haproxy on Ubuntu, and OpenJDK. If these 3 things were combined, we'd see an extra 5 ms delay on every socket connection. Change any one of those 3 factors, and performance was restored.

I'll also post this as an answer, so it can be spotted in both places

3
  • This is something your company really should have looked at as part of a cost/benefit analysis before making the change. Related/cross site dupe: stackoverflow.com/questions/31153584/…
    – Mokubai
    Oct 9, 2018 at 14:42
  • @Mokubai - thanks for the response - I'd seen that, but am looking for more official answers - surely someone reasonably official must have some benchmark comparisons between them?
    – Brad Parks
    Oct 9, 2018 at 14:56
  • From.Java 11, the difference is the install program, and Oracle will offer support to subscribers after 6 month, before that it's free. Oct 9, 2018 at 15:23

3 Answers 3

4

You would find interesting this excerpt from an Oracle blog post:

Q: What is the difference between the source code found in the OpenJDK repository, and the code you use to build the Oracle JDK?

A: It is very close - our build process for Oracle JDK releases builds on OpenJDK 7 by adding just a couple of pieces, like the deployment code, which includes Oracle's implementation of the Java Plugin and Java WebStart, as well as some closed source third party components like a graphics rasterizer, some open source third party components, like Rhino, and a few bits and pieces here and there, like additional documentation or third party fonts. Moving forward, our intent is to open source all pieces of the Oracle JDK except those that we consider commercial features such as JRockit Mission Control (not yet available in Oracle JDK), and replace encumbered third party components with open source alternatives to achieve closer parity between the code bases.

As Oracle is responsible for creating both, it's clear that it will ensure that its clients will have good reasons for paying, and performance is the obvious means.

I believe that OpenJDK is interpreter-only JVM. This is easier to port as it has no architecture specific assembly code but, unfortunately, it's less performant.

OracleJDK I think takes advantage of the platform's floating point ABI (Soft Float on RP1 and Hard Float on RP2). It might also have some amount of platform-specific code to make it faster.

A JIT (just-in-time) compiler was once included in both, named Shark, but I have no knowledge if it is included in OpenJDK. Wikipedia OpenJDK does not mention JIT and I did find this old and troubling issue Remove Shark compiler. However, Wikipedia Java version history does include JIT.

If OracleJDK today includes a platform-specific JIT compiler, but OpenJDK does not, that might well explain the difference in performance,

1
  • "I believe that OpenJDK is interpreter-only JVM" — this is not backed up by your link and nothing similar has ever been posted in Oracle's blogs. Also, these are the commits in OpenJDK 11 containing the word "jit" hg.openjdk.java.net/jdk-updates/jdk11u/…
    – marcus
    Mar 20, 2019 at 15:10
2

As for Java 11, the differences are basically the installer, crypto providers (signed vs. unsigned), and a few command-line options for advanced management and migration from earlier versions, as explained in this Oracle blog post: https://blogs.oracle.com/java-platform-group/oracle-jdk-releases-for-java-11-and-later

Earlier versions had a few additional differences: they had other 2D, font rendering, serviceability/management, and crypto libraries and that could cause performance differences, as explained here: https://www.thegeekdiary.com/openjdk-v-s-oracle-jdk-differences-between-openjdk-and-oracle-jdk/. Memory management and class data sharing could be the reason for different performance characteristics too.

1

For us, the issue was determined to be something to do with haproxy on Ubuntu, and OpenJDK.

If these 3 things were combined, we'd see an extra 5 ms delay on every socket connection.

Change any one of those 3 factors, and performance was restored.

Our particular solution was to change our haproxy load balancers to use Centos instead of Ubuntu.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .