#WISSENTEILEN
Enterprise Java
on Steroids
Java in Zeiten von Cloud-native
Lars Röwekamp | open knowledge GmbH
@_openKnowledge | @mobileLarson
ÜBER OPEN KNOWLEDGE
Branchenneutrale Softwareentwicklung & IT-Beratung
ÜBER MICH
Wer bin ich - und wenn ja, wie viele?
• CIO New Technologies
• Enterprise & Mobile
• Autor, Speaker, Coach & Mentor
• Snowboard & MTB Enthusiast (a.k.a. “stets bemüht“)
Lars Röwekamp (a.k.a. @mobileLarson)
#WISSENTEILEN
… in Zeiten von
Cloud & Serverless
Enterprise
Java …
#WISSENTEILEN
Passt das noch
zu Java EE?
#WISSENTEILEN
Seien wir doch
mal ehrlich!
#WISSENTEILEN
Bedarf in
Zeiten von
Cloud &
Serverless
#WISSENTEILEN
Wo liegt eigentlich das Problem?
Bedarf in Zeiten von Cloud & Co.
• klein a.k.a. niedriger Speicherbedarf
• schnell a.k.a. geringe Startup Time
• flexibel a.k.a. Modularisierung
#WISSENTEILEN
Wo liegt eigentlich das Problem?
Java EE ist
• groß a.k.a. hoher Speicherbedarf
• langsam a.k.a. lange Startup Time
• unflexibel a.k.a. alles oder nix*
* gilt selbst für das stark abgespeckte WebProfile?
#WISSENTEILEN
Wo liegt eigentlich noch das Problem?
#WISSENTEILEN
Wo liegt eigentlich noch das Problem?
#WISSENTEILEN
Wo liegt eigentlich noch das Problem?
Java EE ist
• nicht für Microservices & Cloud konzipiert
• auf eine Runtime zugeschnitten
#WISSENTEILEN
Aber ist das wirklich ein Problem?*
Java EE ist
• stabil
• verbreitet
• standardisiert
• btw: erstes E in JEE steht für Enterprise
* Warum nicht einfach auf JEE verzichten?
#WISSENTEILEN
JEE: „Ich will
mitspielen!“
#WISSENTEILEN
„Gutes“
beibehalten
„Schlechtes“
über Bord werfen
#WISSENTEILEN
#WISSENTEILEN
„proprietäre APIs“
#WISSENTEILEN
Variante: proprietäre APIs
Spezielle APIs für (Micro)Services & Cloud
Embedded lightweight Runtime als „Server“
#WISSENTEILEN
#WISSENTEILEN
Variante: proprietäre APIs
Javalin
• basiert auf Jetty (+3500 LoC)
• simpel, leichtgewichtig, schnell, aktiv
• Fork von SparkJava, beeinflußt von koa.js
#WISSENTEILEN
Variante: proprietäre APIs
Javalin
• APIs für RESTful Services
• APIs für WebSockets / Server-sent Events
• (Servlet) Context Object
• Validation / Converter
• Access Management
#WISSENTEILEN
Javalin
#WISSENTEILEN
Javalin „Hello World“
eigene
APIs
embedded
„Server“
#WISSENTEILEN
Javalin „REST Service“
Server
Bootstraping
REST
Support
#WISSENTEILEN
~ 250 ms / 5 MB
#WISSENTEILEN
Variante: proprietäre APIs
PRO
• spezialisiert
• schmal
• schnell
CONS
• proprietär
• eingeschränkt*
• Micro* vs. Makro
* stark abhängig von dem jeweiligen Framework
#WISSENTEILEN
„weniger ist mehr“
#WISSENTEILEN
Variante: weniger ist mehr
Standard APIs für Microservices
Weglassen von „unnötigen“ APIs
Optionale Erweiterungen für alles Weitere
#WISSENTEILEN
#WISSENTEILEN
Variante: weniger ist mehr
Apache Meecrowave
• Tomcat Servlet Container
• ausgewählte JEE APIs
• CDI - OpenWebBeans
• JAX-RS - CXF
• JSON-P / JSON-B – Johnzon
#WISSENTEILEN
Variante: weniger ist mehr
Apache Meecrowave
• Extensions
• JPA & JTA
• OAuth2 & Let‘s Encrypt
• Monitoring & Testings
#WISSENTEILEN
Meecrowave
#WISSENTEILEN
Meecrowave „Hello World“
eigene APIs
+ embedded Server
JAX-RS
#WISSENTEILEN
Meecrowave „Hello World“
pure JAX-RS
$ mvn package meercowave:run
#WISSENTEILEN
Meecrowave „REST Service“
pure CDI / JAX-RS*
* plus JSON-B
& JSON-P
#WISSENTEILEN
~ 450 ms / 10 MB
* gilt selbst für das stark abgespeckte WebProfile?
#WISSENTEILEN
Variante: weniger ist mehr
PRO
• Standards
• schmal
• schnell
CONS
• Bootstrapping
• eingeschränkt*
• Micro* vs. Makro
* stark abhängig von der jeweiligen Lösung
#WISSENTEILEN
„extended
minimalized
Standard“
#WISSENTEILEN
Variante: eXtended minimalized Standard
Standard APIs für Microservices
Weglassen von „unnötigen“ APIs
plus
gezielte APIs für Cloud & Microservices
#WISSENTEILEN
#WISSENTEILEN
Variante: eXtended minimalized Standard
Eclipse MicroProfile Mission
„An open forum to optimize Enterprise Java
for a microservices architecture by
innovating across multiple implementations
and collaborating on common areas of interest
with a goal of standardization.“
#WISSENTEILEN
Variante: eXtended minimalized Standard
Eclipse MicroProfile
• ausgewählte JEE APIs
• CDI, JAX-RS, JSON-P, JSON-B
• dedizierte Microservices APIs
• Config, Resilience, Security, Monitoring, …
#WISSENTEILEN
#WISSENTEILEN
#WISSENTEILEN
Variante: eXtended minimized Standard
Eclipse MicroProfile
• eine Spezifikation
• Eclipse Foundation
• viele Implementierungen
• Thorntail, Open Liberty, TomEE, Payara,
SmalRye, Helidon, Hammock, …
#WISSENTEILEN
MicroProfile
#WISSENTEILEN
MicroProfile „Hello World“
pure JAX-RS
$ java –jar helloWorld-fat.jar
#WISSENTEILEN
MicroProfile „REST Service“
pure JEE APIs
#WISSENTEILEN
MicroProfile
Health Check
via @Readiness
#WISSENTEILEN
MicroProfile
Metrics
via @Timed
#WISSENTEILEN
MicroProfile
Fault Tolerance
via @Timeout
#WISSENTEILEN
MicroProfile
JWT Auth
via @Inject & @Claim
#WISSENTEILEN
MicroProfile
JWT Auth
via @RolesAllowed*
*pure Jakarta EE
#WISSENTEILEN
~ 1600 ms / 80 MB
#WISSENTEILEN
Variante: eXtended minimized Standard
PRO
• Standards
• Micro & Marko
• schmal*
• schnell*
• flexibel
CONS
• Bootstrapping
• je mehr, desto* …
* ist stark abhängig von den eingebundenen APIs
#WISSENTEILEN
Enterprise Java in Zeiten von Cloud & Co ….
STANDARDPROPRITARY
SLOW
FAST
… or here
! STANDARD
but SLOW
You are here …
! FAST but
PROPRITARY
…but you want
to be here! ? STANDARD
and FAST
#WISSENTEILEN
JEE:
„Was genau war
noch einmal
das Problem?“
#WISSENTEILEN
Aus der Rubik: „Spaß beim Startup …“
internal
once
element
Metadata
Processing
at Startup
#WISSENTEILEN
„Voodoo“
#WISSENTEILEN
„I started thinking about my application’s
performance—in this case, the bootstrap time—and
asked myself whether I was happy with the actual time
my application took to start up. The answer was no.
And, nowadays, this is one of the most important
metrics to be considered when working with
microservices, mainly on a serverless architecture.“
Filipe Spolti, Red Hat
#WISSENTEILEN
#WISSENTEILEN
Die vier Quarkus
Voodoo Regeln
#WISSENTEILEN
„Build-Time
Optimization“
Voodoo #1: be small and fast
#WISSENTEILEN
„Power of
Standards“
Voodoo #2: be convenient
#WISSENTEILEN
„Minimize Development
Turnaround Time“
Voodoo #3: spark joy for developers
#WISSENTEILEN
„Ahead-of-Time
Compilation“
Voodoo #3: be even smaller and faster
#WISSENTEILEN
Variante: Voodoo
Quarkus in a Nutshell
• Support von „leading“ APIs & Frameworks*
• Dependency-Auflösung zur Compile-Time
• kurze Turnaround Zeiten via Dev Mode
• native Container-Images mit GraalVM
*MicroProfile, Netty, Vert.x, Apache Carmel, Elastic Serach, Flyway,
Neo4j, Kafka, ActiveMQ, Kubernetes, AWS Lambda, …
Quarkus
„Voodoo“
in Aktion
optimized
native
executable
*.class
#WISSENTEILEN
Quarkus
#WISSENTEILEN
Quarkus „Hello World“
pure JAX-RS
$ mvn clean quarkus:dev
#WISSENTEILEN
Quarkus „REST Service“
pure MicroProfile
#WISSENTEILEN
~ 1200 ms / 10 KB*
* Paket besteht nur aus MANIFEST.MF (CP Info) und dev-mode-context.dat
Quarkus
DEV
Mode
#WISSENTEILEN
* plus 23 MB /lib
~ 800 ms / 200 KB*
Quarkus
PROD
Mode
#WISSENTEILEN
~ 11 ms / 25 MB
Quarkus
NATIVE
Mode
#WISSENTEILEN
Voodoo vs. Traditional:
Memory (RSS)
REST
13 MB 74 MB 140 MB
Quarkus /
OpenJDK
Traditional
Stack
Quarkus /
GraalVM
#WISSENTEILEN
Voodoo vs. Traditional:
Boot & First Response
Quarkus / OpenJDK
Traditional Stack
Quarkus /GraalVM
0.014s
0.75s
4.3s
0 1 2 3 4 5 6 7 8 9
REST
#WISSENTEILEN
35 MB 130 MB 218 MB
Quarkus /
OpenJDK
Traditional
Stack
Quarkus /
GraalVM
REST
+ CRUD
Voodoo vs. Traditional:
Memory (RSS)
#WISSENTEILEN
Quarkus / OpenJDK
Traditional Stack
Quarkus /GraalVM
0.055s
2.5s
9.6s
0 1 2 3 4 5 6 7 8 9
REST
+ CRUD
Voodoo vs. Traditional:
Boot & First Response
#WISSENTEILEN
Cloud-native?
„A Kubernetes Native Java stack tailored for
GraalVM & OpenJDK Hotspot created from
the best of breed Java libraries and standards.“
#WISSENTEILEN
Was bedeutet das für Cloud-native?
„Container First“ Ansatz von Quarkus
• schmale Pakete == kleine Container Images
• schnelle Boot Time == sofortiges Scale-up
• geringer RSS Speicher == mehr Container*
*bei gleichem RAM
#WISSENTEILEN
Was ist mit
Limitations?
#WISSENTEILEN
Quarkus „Voodoo“
Limitations (GraalVM / SubstrateVM)
• Dynamic Classloading
• Native VM Interfaces
• Reflection*
• Dynamic Proxies*
• Resources* *muss via native-image CLI/API vorab registriert werden
„Brauche ich nicht!
Oder etwa doch?“
#WISSENTEILEN
Quarkus „Voodoo“
Limitations (ArC DI / CDI)
• Conversational Scope
• Decorators
• Portable Extensions
• Transactional Observers
• …
#WISSENTEILEN
Fazit
#WISSENTEILEN
Enterprise Java in Zeiten von Cloud & Co ….
STANDARDPROPRITARY
SLOW
FAST
… or here
! STANDARD
but SLOW
You are here …
! FAST but
PROPRITARY
…but you want
to be here! ? STANDARD
and FAST
#WISSENTEILEN
Enterprise Java in Zeiten von Cloud & Co ….
STANDARDPROPRITARY
SLOW
FAST
… or here
! STANDARD
but SLOW
You are here …
! FAST but
PROPRITARY
STANDARD *
and FAST
!Quarkus
aka Voodoo
#WISSENTEILEN
Enterprise Java in Zeiten von Cloud & Co ….
Voodoo Regeln
• Support von „leading“ APIs & Frameworks
• Dependency-Auflösung zur Compile-Time
• kurze Turnaround Zeiten via Dev Mode
• native Container-Images mit GraalVM
#WISSENTEILEN
Ok, aber
brauche
Ich das
wirklich?
#WISSENTEILEN
#WISSENTEILEN
„You are NOT Amazon,
Twitter or Netflix.“*
* except you are Amazon, Twitter or Netflix ;-)
#WISSENTEILEN
Enterprise Java in Zeiten von Cloud & Co ….
Voodoo Regeln eXtended Version
• “FatJARs are bad.“
• „Layered Containers are good.“
• „Small layered Containers are even better.“
• „Small* layered native Containers are best.“
* Distroless Container Image als extreme Variante
? ? ?
#WISSENTEILEN
@mobileLarson
Kontakt
LARS RÖWEKAMP
CIO NEW TECHNOLOGIES
lars.roewekamp@openknowledge.de
+49 (0)441 4082 – 101
@mobileLarson
@_openknowledge
OFFENKUNDIGGUT
#WISSENTEILEN
Bildnachweise
#5: © Studio Romantic – shutterstock.com
#22: © CandyDuck – shutterstock.com
#79: © Framework Wonderland - shutterstock.com
All other pictures inside this presentation orginate from
pixabay.com or are created by myself.
#WISSENTEILEN

Enterprise Java on Steroids