App backend: first iteration (2015)
AWS EC2
AWS ELB
Wildfly 8
Java 7
Java EE
Application
AWS EC2
MySQL 5
11
•Functions-as-a-service (FaaS)
•Short running
•Small units of execution
•On demand, pay per use, scale to zero
•Startup time matters (for cold starts)
•There are still servers ;-)
Serverless computingBackground source: https://filmquarterly.org/2012/07/02/i-robot-what-do-robots-dream-of/
My first serverless experience (2016)
App backend: second iteration (2018)
AWS EC2
AWS ELB
Spring Boot 2
Java 8
Spring
Application
AWS
DynamoDB
15
First serverless attempt (2019)
•JDK & JVM
•Built by Oracle
•Two runtime options:
•run as JVM (Based on Hotspot) with JIT
•ahead-of-time compilation to platform-
specific native image binary
GraalVM
In the meantime…
•Kubernetes native web framework
•Open source, developed by Red Hat
•Designed to work with Java ecosystem
•Tailored for OpenJDK HotSpot and
GraalVM
•Great developer experience
Quarkus
Second serverless attempt (2022)
Third serverless attempt (2023)
Third serverless attempt (2023)
App backend: third iteration (2023)
AWS Lambda
AWS
API Gateway
GraalVM
native image
Java 17
Quarkus
application
AWS
DynamoDB
Demo time!
Migrating from Spring to Quarkus
Migration: REST endpoints
Migration: REST entity classes
Migration: Other changes
Show me the code!
Experiences from running in productionPhoto: Dave Lehl
Monitoring, performance & scalability
Metrics during J-Fall 2023
Number of invocations per minute
Request duration (1 min avg)
Request duration (1 hour avg)
Success / error count
Concurrent executions
Logs
Costs
AWS costs for J-Fall 2023 app backend
AWS costs for J-Fall 2023 app backend
Is this the holy grail / graal?
•Cross compiling across cpu architectures is slow
•3rd party library support for native images is not
guaranteed (but Quarkus libs are good)
•Reflection and native images can be tricky
•Debugging can be painful if problem is not local
•You need limits on lambda and API GW
•Probably good to use build & deploy pipelines ;-)
Quarkus/GraalVM native/Lambda caveats
Let’s wrap up!
•Serverless Java is totally doable in 2024!
•Quarkus & GraalVM ❤ serverless
•Ideal for small/hobby projects
•As usual, YMMV ;-)
•Demo/seed project:
https://github.com/bertjan, repo:
quarkus-graalvm-aws-lambda-arm64
Summary
Source: https://cdn2.vox-cdn.com/thumbor/J9OqPYS7FgI9fjGhnF7AFh8foVY=/148x0:1768x1080/1280x854/cdn0.vox-cdn.com/uploads/chorus_image/image/46147742/cute-success-kid-1920x1080.0.0.jpg THAT’S IT.
NOW GO KICK SOME ASS!
Questions?
@bjschrijver
Thanks for your time.
Got feedback? Tweet it!
All pictures belong
to their respective
authors
@bjschrijver