Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cloud Native Java with Spring Boot (CNCF Aarhus...

Cloud Native Java with Spring Boot (CNCF Aarhus, April 2024)

Java is a modern and powerful technology stack, making it an excellent choice for developing cloud-native applications. Spring, built on top of Java, offers a broad ecosystem of frameworks and libraries, prioritizing developer experience, production readiness, and cloud integrations.

In this session, Thomas will delve into common patterns and best practices for building cloud-native applications with Java. You will learn how to optimize the developer experience using Spring Boot, leveraging features like live reload and seamless integration with Testcontainers and Docker Compose to streamline development and testing processes.

Next, you will discover how to integrate applications with large language models and vector stores, bringing Generative AI capabilities into Java through Spring AI and LangChain4j. Following this, Thomas will demonstrate how to prepare applications for production by compiling Java into native executables with GraalVM, resulting in instant startup times and reduced memory consumption.

Finally, you will see how to containerize Java applications using Buildpacks, fine-tune observability with Micrometer and OpenTelemetry, and configure serverless deployments on Kubernetes with Knative.

Thomas Vitale

April 18, 2024
Tweet

More Decks by Thomas Vitale

Other Decks in Technology

Transcript

  1. Systematic • Software Engineer • CNCF Ambassador, Oracle ACE Pro,

    Testcontainers Community Champion • Author of “Cloud Native Spring in Action” (Manning). • OSS contributor (Java, Spring, Cloud Native Technologies) Thomas Vitale thomasvitale.com @vitalethomas
  2. From Traditional to Cloud Native Application Server, Embedded Server Runtime

    (JVM) Middleware (Application Server) Application (WAR/EAR) Runtime (JVM) Application (JAR) @vitalethomas
  3. Moving to Containers Application Server, Embedded Server, Container Runtime (OCI)

    Application (Container) Runtime (JVM) Middleware (Application Server) Application (WAR/EAR) Runtime (JVM) Application (JAR) @vitalethomas
  4. Image pack build Cloud Native Buildpacks From source code to

    container image @vitalethomas Cloud Native Buildpacks https://buildpacks.io
  5. Image pack build gradle bootBuildImage Cloud Native Buildpacks From source

    code to container image @vitalethomas Cloud Native Buildpacks https://buildpacks.io
  6. Spring Boot and Native Executables The bene fi ts of

    GraalVM Instant Startup Low Resource Usage Instant Peak Performance @vitalethomas Reduced Surface Attack Compact Packaging
  7. Spring Boot and Native Executables The downsides of GraalVM Slower

    Build Additional con fi guration might be needed @vitalethomas
  8. Packaging Spring Boot JAR, Native, Container Image JAR OCI Image

    Gradle bootJar Maven package Gradle bootBuildImage Maven spring-boot:build-image @vitalethomas Native Gradle nativeCompile Maven -Pnative native:compile
  9. Testcontainers Dev and Test Services OCI containers Run external dependencies

    as OCI containers, also at development time Data Layer Tests Ensure environment parity by testing the data layer with the real database Integration Tests Use containers for databases, message queues, and web servers @vitalethomas
  10. Spring Observability Production-grade features Spring Boot Actuator ‣Health (liveness and

    readiness) ‣Management (loggers, con fi guration) ‣Flyway, Thread Dumps, Heap Dumps Micrometer ‣Uni fi ed Observation API ‣Instrumentation for metrics and traces ‣Prometheus, OpenTelemetry @vitalethomas
  11. Moving to Kubernetes Application Server, Embedded Server, Container, Kubernetes Runtime

    (OCI) Middleware (Kubernetes) Application (Container) Runtime (JVM) Middleware (Application Server) Application (WAR/EAR) Runtime (JVM) Application (JAR) Runtime (OCI) Application (Container) @vitalethomas
  12. Continuous Development Code, Run, Test, Debug Development Workflow gradle bootRun

    flask --debug run yarn dev Dev & Test Services @vitalethomas
  13. Kubernetes Native Spring Boot Workload con fi guration and management

    Liveness Probe Con fi gMaps @vitalethomas Readiness Probe Secrets Service Bindings Runtime Reload
  14. Resources Cloud Native Java with Spring Boot • Presentation source

    code • Spring AI • Spring CLI • LangChain4j Spring Boot • Serverless Java with Spring Boot • Securing the Supply Chain for Your Java Applications • Building AI-Ready Platforms - Symphony for Developer and Platform Engineer @vitalethomas