Modular LIBJVM.SO library for Docker

David Holmes david.holmes at oracle.com
Tue May 25 12:57:18 UTC 2021


On 25/05/2021 8:07 pm, Tibor Digana wrote:
> Hi David,
> 
>  >> I'm not sure why you think the JVM should be comparable in size to 
> the native code used by the core libraries.
>  >> The JVM is a huge piece of native code in comparison to that used by 
> the core libraries.
> 
> Because Oracle had an ambition in the Jigsaw project to develop a 
> modular JDK and there are some consequences in the native JVM.

The JVM can be built with various subcomponents present or absent as 
already stated. How that gets incorporated into a "modular JDK" and used 
with a tool like Jlink is not a question for hotspot-dev - possibly 
jdk-dev would be more appropriate. But there are non-technical 
constraints about what kind of stripped-down JDK you can ship and still 
call it Java. We went down this road in Java 8 with Compact Profiles and 
the MinimalVM.

Cheers,
David
-----

> Nowadays the Java developers utilize the commands with JLINK and they 
> say that they are able to shrink the Java modules to cca 10MB.
> Shrinking them more does not make sense because there is one file which 
> is much bigger - libjvm.so.
> If we are asking about the effort spent in JLINK and the effectiveness 
> of JLINK, we have to say that we should continue with modularity on the 
> JVM level in order to make this process perfect.
> It is not about me and how I write a native code.
> It is about our understanding and how we would agree.
> On one hand you can see the technical things but I can see the marketing 
> and a better reputation of Java especially in the world of Microservices 
> and embedded devices.
> I am using BusyBox and Linux Alpine cca 2.7 MB, and so the libjvm.so ~ 
> 22 MB is 8 times bigger.
> We have to see the ambition of Java itself, e.g. jlink, and the movement 
> towards the Alpine and then we will see that the movement to the Alpine 
> is affected by the size of the JVM library.
> I think the community has to make decisions on a higher level and we 
> have to understand these numbers.
> 
> Cheers
> Tibor
> 
> 
> 
> Cheers
> Tibor
> 
> 
> 
> 
> 
> 
> On Tue, May 25, 2021 at 2:57 AM David Holmes <david.holmes at oracle.com 
> <mailto:david.holmes at oracle.com>> wrote:
> 
>     Hi Tibor,
> 
>     On 25/05/2021 5:26 am, 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.
> 
>     I'm not sure why you think the JVM should be comparable in size to the
>     native code used by the core libraries. The JVM is a huge piece of
>     native code in comparison to that used by the core libraries.
> 
>      > 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?
> 
>     This can be built today (modulo some possible issues Stefan mentioned).
>     You need to find an OpenJDK provider/distributor who is prepared to
>     take
>     on the cost of providing a selection of binaries with different VM
>     features enabled.
> 
>     I've no idea how much size might be saved by stripping out different
>     GC's today.
> 
>     Cheers,
>     David
> 
>      > Thx
>      > Tibor
>      >
> 


More information about the hotspot-dev mailing list