Bring the Action: Using GraalVM in Production (recording)
- GraalVM overview 🐰
- Migrating an app to GraalVM 🤖
- 👩💻 use Native Build Tools 🛠️
- 👩💻 basic performance measurements with
time📈
- Using libraries 📚
- A library might be designed to be Native-Image friendly out of the box;
- A library might add config files to its source code;
- Library configuration can be provided via GraalVM Reachability Metadata Repository;
- 👩💻 You can programmatically generate configuration via framework annotations, such as
@ReflectiveAccess(Micronaut) - You can use Native Image's Tracing Agent (
java -agentlib:native-image-agent -jar ./target/demo.jar) - You can provide configuration manually via json.
- Performance optimizations 🚀
- Overview of compiler optimization levels
- 👩💻 PGO
- ML-enabled PGO
- You get LCOV info as a side product of PGO
- G1 GC
-march=native- Memory management (
xmx) - Demo: spring-petclinic
- Testing 👨🔬
- Deployment 📦
- 👩💻 Packaging and linking options
- JDK
- JDK | Distroless
- JDK | JLink
- Native | Dynamic |
docker build -f Dockerfiles/Dockerfile.native -t native-spring-boot-native:latest .docker run -p 8080:8080 native-spring-boot-native:latest .
- Native | Mostly static | Distroless
- Native | Static | From scratch
- Native | Static | From scratch | Optimize for size
- You can significantly reduce the size by going with Native Image:
- 👩💻 Packaging and linking options
➜ docker images | grep "native"
localhost/native-spring-boot-static-size latest ... ... 58.5 MB
localhost/native-spring-boot-static-scratch latest ... ... 84.4 MB
localhost/native-spring-boot-native latest ... ... 125 MB
localhost/native-spring-boot-jdk-jlink latest ... ... 126 MB
localhost/native-spring-boot-jdk-distroless latest ... ... 218 MB
localhost/native-spring-boot-jdk latest ... ... 480 MB- Scan the images for vulnerabilities & packages 🛡️
- Buildpacks
- GitHub actions
- Security 🛡️
- Security by design
- 👩💻 Vulnerability Scanning
grype:native-image-inspect --sbom ./target/demo-sbom | grype -vnative-image-inspect --sbom ./target/demo-sbom>output.json
- 👩💻 SBOM support: exposing in Spring Actuator
- 👩💻 SBOM support in Micronaut
- GitHub Action
- Demo: native-spring-boot-sbom
- Monitoring 📈
- 👩💻 Micrometer
- (Tempo -> service graph)
- 👩💻
jvmstat - JFR, JMX,
jcmd perf stat <./target/demo>
- 👩💻 Micrometer
- Tooling 🔮
- 👩💻 Build reports
- In the lab 👩🔬
- Some of our research project slogans
- "Why do it? Because we can"
- "We do these things not because they are easy, but because we thought they were going to be easy"
- [Llama3.java]|(https://github.com/mukel/llama3.java)
- Native Image Layers
- Project Crema
-H:Preserve=all- Embedding Python (Pygal charts)
- Wasm backend for Native Image (javac)
- Some of our research project slogans