Slide 1

Slide 1 text

From 0 to Production-Grade with Kubernetes Native Java Francisco Meneses Senior Architect Red Hat Kevin Dubois Senior Principal Developer Advocate Red Hat

Slide 2

Slide 2 text

“Kube Native” Java !?

Slide 3

Slide 3 text

“Traditional” Java ● Throughput at the expense of footprint ● Long running at expense of startup speed ● Rich, dynamic behaviour for mutable systems “Kube Native” Java ● Throughput solved by scaling ● Ephemeral, immutable systems ● Footprint and startup speed matter

Slide 4

Slide 4 text

JVM Scaling increase of load triggers scale up event of pods

Slide 5

Slide 5 text

When you can’t scale fast enough…

Slide 6

Slide 6 text

CRaC

Slide 7

Slide 7 text

Quarkus + Native (via GraalVM) 12 MB Quarkus + JVM (via OpenJDK) 73 MB Traditional Cloud-Native Stack 136 MB Quarkus + Native (via GraalVM) 0.016 Seconds Quarkus + JVM (via OpenJDK) 0.943 Seconds Traditional Cloud-Native Stack 4.3 Seconds Supersonic. Subatomic. Java

Slide 8

Slide 8 text

Let’s start to build our app!

Slide 9

Slide 9 text

Architecture 3: Generate power (REST) Game Dashboard 1: Assign player Name & Team (REST) 6: Update dashboard (SSE) 2: Increment player cluster counter 4: Send power event 5: Receive power events

Slide 10

Slide 10 text

Architecture 3: Generate power (REST) Game 4: Send power event

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

@kevindubois

Slide 13

Slide 13 text

Container Running Sends traffic App not ready Ready??

Slide 14

Slide 14 text

After 2.6s (Kafka, DB, Caching) App is ready to receive traffic Container Running Sends traffic App not ready Ready??

Slide 15

Slide 15 text

Downtime of 2.6s Ready??

Slide 16

Slide 16 text

https://microprofile.io/

Slide 17

Slide 17 text

readinessProbe: httpGet: path: /health port: 8080 initialDelaySeconds: 10 periodSeconds: 3 Ready!

Slide 18

Slide 18 text

resources: requests: memory: "300Mi" cpu: "250m" # 1/4 core limits: memory: "400Mi" cpu: "1000m" # 1 core Resource Limits

Slide 19

Slide 19 text

CPU Request More CPU Limit State your intentions

Slide 20

Slide 20 text

Memory Request More Memory Limit Burstable

Slide 21

Slide 21 text

Memory Request Limit Guaranteed

Slide 22

Slide 22 text

https://learn.microsoft.com/en-us/azure/developer/java/containers/overview vCPU cores Memory Heap Size GC Replicas 2 4Gb 75% Parallel 2 Some sensible starting numbers

Slide 23

Slide 23 text

https://learn.microsoft.com/en-us/azure/developer/java/containers/overview resources: requests: memory: "4000Mi" cpu: "2000m" limits: memory: "4000Mi" cpu: "2000m" - env: - name: JDK_JAVA_OPTIONS value: "-XX:+UseParallelGC -XX:MaxRAMPercentage=75" Sensible Initial Values ( JVM )

Slide 24

Slide 24 text

containers: - name: nginx-container image: nginx:latest ports: - containerPort: 80 volumes: - name: secret-volume secret: secretName: your-secret-name Kubernetes Secrets & ConfigMaps

Slide 25

Slide 25 text

@kevindubois @alexsotob Observability

Slide 26

Slide 26 text

Ready for Production!

Slide 27

Slide 27 text

Architecture 3: Generate power (REST) Game Dashboard 1: Assign player Name & Team (REST) 6: Update dashboard (SSE) 2: Increment player cluster counter 4: Send power event 5: Receive power events

Slide 28

Slide 28 text

Push to give energy windmill Kafka Topic 2.Sends the interaction Dashboard: Green Energy Nickname Team SHAKE! to generate energy Cars that need energy Two teams competing (top 5 players) First team wins @kevindubois @alexsotob

Slide 29

Slide 29 text

Shaking Time :)

Slide 30

Slide 30 text

V2 Scan the QR Code with your phone to play

Slide 31

Slide 31 text

github.com/kdubois/quarkus-kubernetes-kafka-db github.com/redhat-developer-demos/quinoa-wind-turbine

Slide 32

Slide 32 text

Free Developer e-Books & Tutorials! developers.redhat.com/eventtutorials

Slide 33

Slide 33 text

Start exploring in the OpenShift Sandbox. Learn containers, Kubernetes, and OpenShift in your browser. developers.redhat.com/developer-sandbox Try Red Hat's products and technologies without setup or configuration.

Slide 34

Slide 34 text

muchas gracias! youtube.com/@thekevindubois linkedin.com/in/kevindubois github.com/kdubois @kevindubois slides