Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deployment is bigger than with other JREs #511

Open
mlaggner opened this issue Feb 6, 2025 · 4 comments
Open

Deployment is bigger than with other JREs #511

mlaggner opened this issue Feb 6, 2025 · 4 comments
Assignees

Comments

@mlaggner
Copy link

mlaggner commented Feb 6, 2025

I recently switched from the Azul JRE to the JBR JRE and recognized, that my deployment is much bigger than with the Azul JRE.

Hunting down the issue has shown me, that the /lib/modules from your JRE heavily differs from Azul (and also Adoptium, which I analyzed too). It looks like that on JBR the modules container has been built with the parameter --compress=2 (probably here if I found the right script: https://github.com/JetBrains/JetBrainsRuntime/blob/jbr-release-21.0.6b872.80/jb/project/tools/windows/scripts/mkimages_x64.sh#L64) which results in a "slightly" compressed modules container (57MB vs 100MB from Azul/Adoptium).

This leads to another "problem" if you package your final app for deployment (especially with LZMA - I've tested XZ and ZSTD) - the modules can't be compressed any further (57MB from the JRE -> 53MB compressed) while other JVMs (Azul/Adoptium) can be compressed by far better (100MB from the JRE -> 24MB compressed).

Having said this, I also compared the compression of the whole JRE between JBR/Azul/Adoptium (all 21.0.6) with XZ and the best compression algorithm. I know that the JREs differ slightly, but the finally compressed archive should not differ that much. But JBR is by far bigger than others:

  • JBR - 69MB
  • Azul - 29MB
  • Adoptium - 29MB

To get those results, I made many tests comparing different parts of the JVM at all and it looks like LZMA cannot compress the modules any further.

Having said this, I am unsure what benefits the compression of /lib/modules offers beside saving ~43MB of storage (runtime). The drawback here is that the JVM probably needs to extract the container at runtime (performance) and the deployment size is just bigger for many use cases (especially if you plan to re-package the final deployment with LZMA - waste of bandwidth).

@mkartashev
Copy link
Collaborator

I'd also check if the modules list is the same (java --list-modules). JRE is not standardized so different vendors may include different sets of modules.

@mlaggner
Copy link
Author

mlaggner commented Feb 6, 2025

You are right - the modules differ:

  • JBR - 56 modules
  • Azul - 52 modules
  • Adoptium - 49 modules

also just from the amount of modules it is hard to compare, so I decided to extract the modules container and compare the uncompressed storage size of the modules too:

  • JBR - 189MB
  • Azul - 151MB
  • Adoptium - 150MB

so yes - the uncompressed modules from JBR are ~ 38MB bigger than the counterpart of Azul/Adoptium. But a difference of 38MB should not be the same difference after being compressed with LZMA!

@mkartashev mkartashev self-assigned this Feb 6, 2025
@mkartashev
Copy link
Collaborator

I'm not sure I understand what exactly is the issue you would like to get addressed here?

@mlaggner
Copy link
Author

mlaggner commented Feb 6, 2025

When I use JBR as the JRE inside my app, I see that the deployment is unnaturally bigger in comparison to other JREs. The difference in my deployment is ~40MB (packaged size) which is kinda huge and I just wanted to ask you, if there is a good reason that you packaged the /lib/modules container in JBR the way you do (which is different from Azul and Adoptium).

As I wrote above, the main reason why the deployment is quite different in size is the way you have built /libs/modules. If you do have a reason you packaged this the way you do, everything is good. If you were not aware that this can have some bad influence for repackaging, I'd suggest you to do it like Azul/Adoptium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants