Modular LIBJVM.SO library for Docker

Andrew Dinn adinn at redhat.com
Tue May 25 10:37:40 UTC 2021


On 25/05/2021 11:07, Tibor Digana wrote:
> 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.
I understand why you might want a more lightweight JVM that can minimise 
resource usage. However, that's primarily going to require a saving in 
data footprint because most of the code in the JVM cannot be removed. It 
might well be possible to retune the code, say to trade off space 
against execution time. However, there is very little redundancy in 
terms of function. The GCs provide one significant exception, use of two 
JIT compilers in a tiered configuration is another.

However, I am unclear why you care so much about this redundancy in 
relation to the size of the library on disk? There may well be code for 
six different GCs in the library but only one of them will actually be 
executed at runtime. Similarly, you can limit the JVM to use just one 
JIT compiler by runnign with -XX:-TieredCompilation.

So, only one GC and, if you choose, only one JIT compiler will be 
consuming memory pages for the corresponding code and data pages in the 
image. Code or data pages for the unselected GCs will not incur physical 
memory costs. In other words the apparent bloat you see in having such 
redundant elements in the disk image will not be replicated by a 
comparable increment in the resident memory image.

So, can you explain: why *do* you care about the disk size of the 
library? Is the cost of disk space really a big issue vs other overheads 
such as the cost of the electricity to run the program? Is the time or 
network bandwidth required to provision an extra 20MBs of image onto a 
machine adding a significant amount to your costs?

regards,


Andrew Dinn
-----------
Red Hat Distinguished Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill



More information about the hotspot-dev mailing list