Productivity, Sustainability, and Fun in modern Java Oleg Šelajev @shelajev

Developer advocate atomicjar.com testcontainers.org

Modern

About Java releases 2 releases / year Oracle LTS every 4th release Multiple vendors GraalVM

Text blocks

Records

instanceof pattern matching

Switch expressions

Pattern matching for switch

Sealed classes

Fast

Copyright © 2021, Oracle and/or its affiliates

Startup Speed Peak Throughput JIT AOT Reduced Max Latency Low Memory Footprint Small Packaging

Native Image Build Process Input: All classes from application, libraries, and VM Application Output: Native executable Points-to Analysis Ahead-of-Time Compilation Libraries Code in Text Section Run Initializations JDK Substrate VM Heap Snapshotting Iterative analysis until fixed point is reached Image Heap Writing Image Heap in Data Section

Configuring Native Image build: Reflection, Proxies, JNI, Resources, etc https://medium.com/graalvm/working-with-native-image-efficiently-c512ccdcd61b

Configuring Native Image build: Reflection, Proxies, JNI, Resources, etc java -agentlib:native-image-agent=\ config-output-dir=META-INF/native-image \ -jar App.jar https://medium.com/graalvm/working-with-native-image-efficiently-c512ccdcd61b

https://medium.com/graalvm/graalvm-21-3-is-here-java-17-native-image-performance-updates-and-more-ac4cbafcfc05

Build tools • sbt native client • • • https://www.scala-sbt.org/1.x/docs/sbt-1.4-Release-Notes.html https://asciinema.org/a/wAAYjiO0TNW0V7dCSebMQB5wa mvnd • https://github.com/mvndaemon/mvnd

GraalVM Native Image Support in the AWS SDK for Java 2.x The test application creates an S3Client with ApacheHttpClient and sends a simple GetObjectRequest. In our testing, we measured the SDK 2.x startup time and the first request latency as well as the memory usage. https://aws.amazon.com/blogs/developer/graalvm-native-image-support-in-the-aws-sdk-for-java-2-x/

Writing Kubectl plugins with Scala or Java, with Fabric8 Kubernetes client on GraalVM Rewriting a kubectl plugin from a standard Go stack to a more comfortable approach with Scala has been challenging and rewarding. We are really happy with the result, and we arguably improved it in several ways. https://www.lightbend.com/blog/writing-kubectl-plugins-with-scala-or-java-with-fabric8-kubernetes-client-on-graalvm

Lightweight

Integration tests Testcontainers Database app Kafka API

🐋 https://medium.com/@bsideup/testing-your-docker-containers-with-testcontainers-and-groovy-3b9ef97ad1c2

Local environment Testcontainers Database app Kafka API

Testcontainers Cloud https://www.atomicjar.com/2021/11/announcing-testcontainers-cloud/

Fast Modern Lightweight *