Modular LIBJVM.SO library for Docker

Remi Forax forax at univ-mlv.fr
Mon May 24 21:45:12 UTC 2021


----- Mail original -----
> De: "Tibor Digana" <tibordigana at apache.org>
> À: "Stefan Karlsson" <stefan.karlsson at oracle.com>
> Cc: "hotspot-dev" <hotspot-dev at openjdk.java.net>
> Envoyé: Lundi 24 Mai 2021 22:29:05
> Objet: Re: Modular LIBJVM.SO library for Docker

> Hi Stefan,
> 
> .. but I am a user and I like downloading the Openjdk images from docker
> hub, not compiling them.
> It is not a realistic solution to recompile the sources.
> We are looking for a way to minimize the memory footprint in Docker and so
> this LIBJVM was found too big.

Do you know that you can compile the JDK source in a docker container itself with a multi stage build ? [1]

Also if you want a small image and don't care too much about peak performance,
maybe you should take a look at the Graal Native image [2].

> Cheers
> Tibor

regards,
Rémi

[1] https://docs.docker.com/develop/develop-images/multistage-build/
[2] https://www.graalvm.org/reference-manual/native-image/

> 
> 
> 
> 
> 
> 
> 
> On Mon, May 24, 2021 at 9:54 PM Stefan Karlsson <stefan.karlsson at oracle.com>
> wrote:
> 
>> Hi Tibor,
>>
>> On 2021-05-24 21:26, Tibor Digana wrote:
>> > Hi,
>> >
>> > The size of the library "libjvm.so"o is bigger than Java modules, and
>> > bigger or comparable with the size of the application in the Docker
>> image.
>> >
>> > After processing the JDK by the JLINK and shrinking the native library "
>> > libjvm.so" my JRE is 35MB big in Docker image but the "libjvm.so" is too
>> > big, i.e. 18MB (from the original size 22MB) and the modules have only
>> 12MB.
>> >
>> > We have many GC algorithms in the JVM and maybe this is the reason why
>> the
>> > library is bigger than the Java modules and then JLINK does not become
>> much
>> > effective.
>> >
>> > Can you please develop a modular JVM library so that I would be able to
>> > select only one algorithm of GC which means that the modules with other
>> GC
>> > algorithms would not appear in my Docker image?
>>
>> FWIW, we don't have a modular JVM, but we have support to remove GCs
>> from the compilation of libjvm.so. All combinations are not always
>> maintained, so you might have to propose patches to fix some of the
>> issues you find.
>>
>> If you run:
>> bash configure --help
>>
>> you'll get a list of --enable-jvm-feature-X for the features you can
>> compile into the JVM. Use corresponding --disable- flag to remove the
>> feature. For example: --disable-jvm-feature-g1gc removes G1 from the
>> libjvm.so.
>>
>> HTH,
>> StefanK
>>
>> >
>> > Thx
>> > Tibor
>>


More information about the hotspot-dev mailing list