Description
I'm opening this issue as a precursor to a future PR based on this thread in the mailing list [1].
For background, I had done an experiment [2] to compare Jenkins startup and footprint in Docker using both Hotspot and OpenJ9 [3]; with a primed -Xshareclasses
option, I found a ~35% improvement in startup time and a ~80% improvement in footprint when using OpenJ9. The takeaway from the email thread was that the community is open to adding a new Docker file for OpenJ9. As such, this issue is mainly to track what might be involved for this endeavour since we don't have a PR available (I'm going on vacation, so this way someone else on our side can hopefully pick this up in the mean time); it also means that we can start having the technical discussions with the Jenkins community.
As far as I can tell, what would be involved would be:
- Change
openjdk:8-jdk-stretch
toadoptopenjdk/openjdk8-openj9:latest
; currently there's some issues with the latest OpenJ9 release (0.15.1 on Java 8; nightlies are fine), so this would have to wait until 0.17. - Add
gpg fontconfig
to the set of toolsapt-get
has to install - Add
OPENJ9_JAVA_OPTIONS="-Xshareclasses -Xscmx80M"
tojenkins.sh
; more details on-Xshareclasses
available here [4] - In the Dockerfile, start and stop Jenkins so that the Shared Classes Cache (SCC) gets populated with bootstrap and core Jenkins classes + AOT code
- At the very end it might be necessary to update
OPENJ9_JAVA_OPTIONS
to beOPENJ9_JAVA_OPTIONS="-Xshareclasses,readonly -Xscmx80M
. However, I'm not 100% sure about this: one the one hand, if thereadonly
flag doesn't exist, then if a new layer is added to the image and the JVM stores more data to the SCC, it will duplicate the SCC in the new layer which will increase on-disk image size; on the other hand, if the user sets up their Jenkins instance by installing plugins and what not, it will result in actually useful Java classes + AOT code added to the SCC which will be beneficial when they commit that new layer and start containers off of that. [5] is meant to address this so perhaps if the next OpenJ9 release has this feature, this point becomes moot.
[1] https://groups.google.com/forum/#!topic/jenkinsci-dev/Lr651X0eCgA
[2] https://blog.openj9.org/2019/09/17/comparing-jenkins-startup-in-docker/
[3] https://github.com/eclipse/openj9
[4] https://www.eclipse.org/openj9/docs/xshareclasses/
[5] eclipse-openj9/openj9#5480