Slide 1

Slide 1 text

Thomas Vitale DevBcn July 4th, 2023 Serverless Java with Spring Boot @vitalethomas

Slide 2

Slide 2 text

Systematic • Software Engineer and Cloud Architect. • Author of “Cloud Native Spring in Action” (Manning). • OSS contributor (Java, Spring, Cloud Native Technologies) Thomas Vitale thomasvitale.com @vitalethomas

Slide 3

Slide 3 text

Serverless @vitalethomas

Slide 4

Slide 4 text

1. No Servers @vitalethomas

Slide 5

Slide 5 text

1. No Servers Infrastructure @vitalethomas

Slide 6

Slide 6 text

Serverless Architectures Developers focus on code Focus on business logic Developer Platform Infrastructure Provisioning Workload Management Dynamic Scaling @vitalethomas

Slide 7

Slide 7 text

JAR Serverless Platforms From application artifact to URI @vitalethomas packaged as OCI Image deployed on deployed on

Slide 8

Slide 8 text

Serverless Platforms From application artifact to URI @vitalethomas aws lambda create-function --function-name Uppercase --zip-file java-function.jar kn service create uppercase --image ghcr.io/thomasvitale/java-function

Slide 9

Slide 9 text

thomasvitale.com @vitalethomas https://tag-app-delivery.cncf.io/whitepapers/platforms @vitalethomas

Slide 10

Slide 10 text

2. Scale to Zero @vitalethomas

Slide 11

Slide 11 text

2. Scale to from Zero @vitalethomas

Slide 12

Slide 12 text

GraalVM @vitalethomas

Slide 13

Slide 13 text

Spring Boot 3 and Native Executables The bene fi ts of GraalVM Instant Startup Low Resource Usage Instant Peak Performance @vitalethomas Reduced Surface Attack Compact Packaging

Slide 14

Slide 14 text

Spring Boot 3 and Native Executables The downsides of GraalVM Longer Build Time Additional con fi guration might be needed @vitalethomas

Slide 15

Slide 15 text

CRaC @vitalethomas

Slide 16

Slide 16 text

3. Functions @vitalethomas

Slide 17

Slide 17 text

Functional Programming Paradigm Java Functional Interfaces Supplier Function Consumer @vitalethomas

Slide 18

Slide 18 text

Function Composition Data processing via functions uppercase() sentence() “I play the PIANO” “piano” “PIANO” @vitalethomas

Slide 19

Slide 19 text

Spring Cloud Function @vitalethomas

Slide 20

Slide 20 text

@vitalethomas Spring Cloud Function Java Function Spring Cloud Function

Slide 21

Slide 21 text

Spring Cloud Function Business logic as functions Transparent Type Conversion Function Arity Function Composition Reactive Support JAR Functions @vitalethomas

Slide 22

Slide 22 text

4. Triggers @vitalethomas

Slide 23

Slide 23 text

@vitalethomas Spring Cloud Function Java Function Spring Cloud Function

Slide 24

Slide 24 text

@vitalethomas AWS Lambda Spring Cloud Function Java Function AWS Lambda org.springframework.cloud spring-cloud-function-adapter-aws

Slide 25

Slide 25 text

@vitalethomas Azure Function Spring Cloud Function Java Function Azure Functions org.springframework.cloud spring-cloud-function-adapter-azure

Slide 26

Slide 26 text

@vitalethomas Google Cloud Function Spring Cloud Function Java Function Google Cloud Functions org.springframework.cloud spring-cloud-function-adapter-aws

Slide 27

Slide 27 text

@vitalethomas Spring Web Spring Cloud Function Java Function Web Applications

Slide 28

Slide 28 text

5. Event-driven @vitalethomas

Slide 29

Slide 29 text

@vitalethomas Spring Cloud Stream Spring Cloud Function Java Function Event-driven Applications

Slide 30

Slide 30 text

Spring Cloud Stream @vitalethomas

Slide 31

Slide 31 text

Spring Cloud Stream Event-driven applications Integration with event brokers Bindings with functions Publish Subscribe Consumer Groups Partitions @vitalethomas

Slide 32

Slide 32 text

Testcontainers Development and testing with external dependencies OCI containers Run external dependencies as OCI containers 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

Slide 33

Slide 33 text

6. Developer Experience @vitalethomas

Slide 34

Slide 34 text

Developer Experience “…developer experience could be defined as a means for capturing how developers think and feel about their activities within their working environments, with the assumption that an improvement of the developer experience has positive impacts on characteristics such as sustained team and project performance.” (F. Fagerholm, J. Münch) Developer Experience: Concept and De fi nition (F. Fagerholm, J. Münch) @vitalethomas

Slide 35

Slide 35 text

“Friends don’t let friends write Dockerfiles!” - Josh Long @vitalethomas

Slide 36

Slide 36 text

Dockerfiles “Dockerfiles are easy to write, but the current development guidelines do not produce containers that are repeatable and hardened.” CNCF Software Supply Chain Security Paper https://github.com/cncf/tag-security/tree/main/supply-chain-security @vitalethomas

Slide 37

Slide 37 text

Image pack build Cloud Native Buildpacks From source code to container image @vitalethomas

Slide 38

Slide 38 text

Image pack build gradle bootBuildImage Cloud Native Buildpacks From source code to container image @vitalethomas

Slide 39

Slide 39 text

Deploying Functions with Knative From idea to deployment with autoscaling URL func create Image func deploy Kubernetes Cluster Container Container Container Knative Serving @vitalethomas

Slide 40

Slide 40 text

Deploying Functions with Knative From idea to deployment with autoscaling URL func create Image func deploy Kubernetes Cluster Container Container Container Knative Serving @vitalethomas

Slide 41

Slide 41 text

Resources @vitalethomas

Slide 42

Slide 42 text

github.com/ThomasVitale/serverless-java-with-spring-boot

Slide 43

Slide 43 text

https://github.com/ThomasVitale/awesome-spring

Slide 44

Slide 44 text

Thomas Vitale DevBcn July 4th, 2023 Serverless Java with Spring Boot @vitalethomas