Slide 1

Slide 1 text

Ondro Mihályi @OmniFishEE Afraid of Java cold starts in Serverless? Fear not, Java is super fast!

Slide 2

Slide 2 text

Ondro Mihályi @OmniFishEE Who am I? Java Champion Czech JUG lead (CZJUG) jug.cz or java.cz Jakarta EE specifications committer Director at OmniFish

Slide 3

Slide 3 text

Ondro Mihályi @OmniFishEE Extensions Runtime Function Request Extensions Runtime INIT INVOKE SHUTDOWN At cold start Every invocation Leads to a cold start AWS Lambda Lifecycle

Slide 4

Slide 4 text

Ondro Mihályi @OmniFishEE Extensions Runtime Function Request INIT INVOKE At cold start Every invocation Our code (Java)

Slide 5

Slide 5 text

Ondro Mihályi @OmniFishEE Extensions Runtime Function Request INIT INVOKE Every invocation Our code (Java) We pay only for this AWS Supported Runtimes

Slide 6

Slide 6 text

Ondro Mihályi @OmniFishEE Where’s the catch? ● Only specific language versions are supported – Java 11, Java 8 ● Java 17 still missing ● Some optimizations require a custom runtime

Slide 7

Slide 7 text

Ondro Mihályi @OmniFishEE Extensions Runtime Function Request INIT INVOKE Our code (Java) We pay for everything Our custom runtime

Slide 8

Slide 8 text

Ondro Mihályi @OmniFishEE https://mikhail.io/serverless/coldstarts/aws/ Cold start times on AWS Lambda

Slide 9

Slide 9 text

Ondro Mihályi @OmniFishEE Java startup time Plain Java starts fast In milliseconds, way faster than application servers or most frameworks

Slide 10

Slide 10 text

Ondro Mihályi @OmniFishEE How fast can Jakarta EE be? Anything close to plain Java start-up times?

Slide 11

Slide 11 text

Ondro Mihályi @OmniFishEE Quarkus framework Jakarta EE MicroProfile Vert.x RestEasy Arc (CDI)

Slide 12

Slide 12 text

Ondro Mihályi @OmniFishEE Overview of Quarkus AOT code optimization at build time Plugins for many libraries Imperative & reactive AOT injection at the core Compile to native using Graal VM

Slide 13

Slide 13 text

Ondro Mihályi @OmniFishEE Piranha Cloud Introducing Piranha Cloud Exousia (Authorization) Eleos (Authentication) Expressly (EL) Transact (JTA) WaSP (JSP) Jersey (REST) Eclipselink (JPA) Weld (CDI)

Slide 14

Slide 14 text

Ondro Mihályi @OmniFishEE Architecture of Piranha Cloud Bare‑bone & fast Servlet container Flat classpath, easy to embed Jakarta EE distributions Extremely modular & extensible Plain Java, no magic

Slide 15

Slide 15 text

Ondro Mihályi @OmniFishEE

Slide 16

Slide 16 text

Ondro Mihályi @OmniFishEE Further optimizations More CPU+RAM Faster JVM Disable 2nd tier compilation Custom JVM (JLink) Native binary (GraalVM) ● CDS ● CRaC

Slide 17

Slide 17 text

Ondro Mihályi @OmniFishEE Conclusion? Similar APIs (Jakarta EE, MicroProfile) Different approaches (AOT vs. Optimized code) Java is not slow, frameworks are slow Piranha and Quarkus can get you up to speed

Slide 18

Slide 18 text

Ondro Mihályi @OmniFishEE Questions

Slide 19

Slide 19 text

Ondro Mihályi @OmniFishEE OmniFish - Jakarta EE Consulting & Support Jakarta EE Consultancy (migrations, tuning) Jakarta EE Application Development GlassFish Server Support omnifish.ee Jakarta EE Training