https://github.com/entur/jvm-module-size-calculator
Utilities for JVM module size calculation
https://github.com/entur/jvm-module-size-calculator
docker java17 jdeps jlink jvm spring-boot
Last synced: 3 months ago
JSON representation
Utilities for JVM module size calculation
- Host: GitHub
- URL: https://github.com/entur/jvm-module-size-calculator
- Owner: entur
- License: eupl-1.2
- Created: 2023-09-15T16:42:14.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-17T11:04:42.000Z (over 1 year ago)
- Last Synced: 2025-01-17T21:09:24.680Z (5 months ago)
- Topics: docker, java17, jdeps, jlink, jvm, spring-boot
- Language: Java
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# jvm-module-size-calculator
Utility project for calculating the size of modules within a JVM distribution.This calculator will help you determine how much your JVM distribution (i.e. docker image) can be reduced in size for a specific application.
# License
[European Union Public Licence v1.2](https://eupl.eu/).# Usage
## Calculator
Build the Maven project,```
cd calculator
mvn clean package
```then run
```
java -jar target/calculator-0.0.1-SNAPSHOT.jar
```to see the module size within the currently installed JVM.
Run
```
java -jar target/calculator-0.0.1-SNAPSHOT.jar
```i.e.
```
java -jar target/calculator-0.0.1-SNAPSHOT.jar java.base,java.compiler,java.desktop
```to calculate the size of modules within the current JVM.
## Docker
List module sizes using the script```
./printModuleSizes.sh
```i.e.
```
./printModuleSizes.sh bellsoft/liberica-runtime-container:jdk-all-17-musl
```or calculate specific module sizes using
```
./calculateModulesSize.sh
```i.e.
```
./calculateModulesSize.sh bellsoft/liberica-runtime-container:jdk-all-17-musl "java.base,java.compiler,java.desktop,java.instrument,java.management,java.naming,java.net.http,java.prefs,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,java.xml.crypto,jdk.httpserver,jdk.jfr,jdk.unsupported,jdk.xml.dom"
```# Example
The project includes a [fully working example](images/liberica) for Liberica docker images with bash scripts:* builds Spring Boot Maven project
* extracts the relevant modules using `jdeps`
* builds a custom base image using `jlink`
* builds a custom image with the Maven artifact