OpenJ9 class sharing

We run dozens of Metabase Docker containers on a single server (with Docker Compose) and would like to optimise the memory footprint.

I modified the Dockerfile to make use of OpenJ9 instead of HotSpot and have enabled class sharing by providing the following options:

JAVA_OPTS=-Xquickstart -Xshareclasses:cacheDir=/cache,verbose,checkURLTimestamps,persistent -Xscmx300M

But I am only able to have Java share its own libraries code:

root@f7dc95f540cf:/# java -Xshareclasses:cacheDir=/cache,printStats=classpath
1: 0x00007F5ACE807F1C CLASSPATH

Current statistics for cache "sharedcc_root": 

Cache created with:
	-Xnolinenumbers                      = false
	BCI Enabled                          = true
	Restrict Classpaths                  = false
	Feature                              = cr

Is there a way to have OpenJ9 also share all Metabase classes?

Solved by upgrading to Java 13.

1 Like