With the recent proliferation of Java Virtual Machine (JVM) implementations, it’s difficult to know which implementation is the best for your use case. While proprietary vendors generally prefer Oracle Java, there are several open source options with different approaches and capabilities.
Given how the implementations vary in some underlying technical specifics, the “correct” JVM implementation will vary based on the use case. Apache Sling, in particular has some specific needs given the complexity of the OSGi / JCR backend and the Sling Resource Resolution framework.
To help get some real data on which JVM implementation works best for running Apache Sling, I created a project to:
- Install a number of JVM implementations and monitoring tools
- For each JVM:
- Consolidate the data into a CSV
If you are curious, you can checkout the Sling JVM Comparison project on Github.
The project installs and compares the following JVM implementations on version 11:
- Eclipse OpenJ9 – 11.0.8 – openj9-0.21.0, JRE 11
- Amazon Coretto – 126.96.36.199.1
- OpenJDK Hotspot – 11.0.8+10
- Oracle JDK – 11.0.8+10-LTS
- Azul Zulu – 11.0.8+10-LTS – 11.41+23-CA
- GraalVM – CE 20.1.0 – 11.0.7+10-jvmci-20.1-b02
Startup / Install Performance
An important performance comparison is the amount of time it takes to get an instance running. To measure this, I captured the time in milliseconds to start the Apache Sling CMS instance and the amount of time required to upload and install the same content package. There is a potential variance in the capture of the startup time as the test process polls the Sling instance to see when it responds successfully to a request to determine startup time.
Amplify Your Value With Custom Product Development
The world has changed, with digital presenting unprecedented opportunities for new revenue streams for companies across industries. How you can take advantage of and exploit your unique offerings to your competitive advantage by exploring custom development?
OpenJDK Hotspot and Amazon Coretto are essentially tied as the leaders of the pack with Oracle JDK and GraalVM following shortly behind. Azul Zulu and Eclipse OpenJ9 take 78% and 87% longer to start as OpenJDK Hotspot. Interestingly, most of the JVM implementations take approximately the same time to install the content package, however, Eclipse OpenJ9 takes 35% longer to install the content package.
Performance Under Load
To check performance under load, I tested the instances using siege using a list of URLs over the course of an hour with blocks of 15 minutes on and 15 minutes off.
First, we can take a look at the throughput per second:
And next, we can look at the raw transaction count:
Both show the same story, OpenJDK Hotspot, Amazon Coretto and Oracle JDK taking the top spots for performance with GraalVM, Azul Zulu and Eclipse OpenJ9 trailing behind.
Finally, given how memory intensive Java applications can be, it’s important to consider memory usage and here the differences are quite stark:
Eclipse OpenJ9 is significantly less memory intensive, using only 55% of the average memory of the 4 middle-tier JVM implementations. GraalVM also sits outside the average, using 15% more memory than the same middle-tier JVM implementations.
Summary and Findings
From a raw performance perspective, OpenJDK Hotspot is the clear winner with Amazon Coretto close behind. If you are all in on Amazon or want a long-term supported JVM option, Amazon Coretto would be worth considering.
For those running Apache Sling on memory-limited hosting options, Eclipse OpenJ9 is the best option. While there is a tradeoff for performance, when you only have a Gigabyte or two of memory, reducing the load by 45% will make a tremendous difference.
Thanks to Paul Bjorkstrand for coming up with idea for this post.