theme: OCI White slidenumbers: false [.hide-footer]
- Graeme Rocher
- Creator of Grails and Micronaut
- Principal Engineer at Object Computing
- Oracle Groundbreaker Award Winner
- Challenges Facing Java and Software in General
- Serverless vs. Traditional Models
- Emerging Solutions (Micronaut and GraalVM)
- Demos!
- Challenges to using Java in Serverless / Microservices scenarios
- Existing Tools and Frameworks Not Optimized for Cold Starts / Low Memory
- Go, Node etc. better in this regards
- Tim Bray (Amazon/AWS) and others not recommending Java
- Optimize for cold starts
- Forget about connection pools
- Don't bother with local caches
- Choose technology based on your cold start requirements
- Cold starts less important, but still important
- The Container is the deployment unit
- Containers and Java require special memory management
- Optimization for memory usage required
[.hide-footer]
Spring is an amazing technical achievement and does so many things, but does them at runtime.
- Reads the byte code of every bean it finds
- Synthesizes new annotations for each annotation on each bean method, constructor, field etc. to support Annotation metadata
- Builds Reflective Metadata for each bean for every method, constructor, field etc.
- Tough technology decisions ahead
- Choose appropriately tool for the job
- Traditional frameworks often not the best choice
[.hide-footer]
- Frameworks based on reflection and annotations become fat
- But we love the programming model and productivity so we live with it
- So ... why should we be more efficient?
[.hide-footer]
[.hide-footer]
- Limited Annotation API
- Type Erasure
- Slow Reflection
- Reflective Data Caches
- Classpath Scanning
- Slow Dynamic Class Loading
- Greatly Exaggerated (Java has been dead forever)
- Java can be Fast! (see Android and Micronaut)
- However Most Existing Tools are based around
- Reflection
- Runtime Proxies
- Runtime Byte Code Generation (bytebuddy/cglib)
- Mature, Robust Ecosystem
- Outstanding IDEs
- Code Maintenance and Refactoring
- Developer Availability
- Build System Maturity
- Diversity (Mobile, IoT, Server Side)
- Languages (Java, Kotlin, Groovy, Scala)
- The Android Community already solved the problem
- Ahead of Time Compilation used extensively
- Google Dagger 2.x
- Compile Time Dependency Injector
- Reflection Free
- Limited in Scope to just DI
- So what is Ahead of Time (AOT) compilation?
- Pre-computation of application code using closed world static analysis
- Fancy way of saying do more at compilation time and less at runtime
[.hide-footer]
- A Microservices and Serverless Focused framework (hence the branding)
- Also a Complete Application Framework for any type of Application
- Dependency Injection, Aspect Oriented Programming (AOP), Configuration Management, Bean Introspection and more..
- All Dependency & Configuration Injection
- Annotation Metadata (Meta annotations)
- AOP Proxies
- Essentially all framework infrastructure
- ie. What Spring/CDI do at runtime
- Microservices
- Serverless Applications
- Message-Driven Applications with Kafka/Rabbit
- CLI Applications
- Even Android Applications
- Anything with
static void main(String..args)
- An Application Framework for the Future
- Reflection Free, Runtime Proxy Free, No Dynamic Classloading
- Ahead of Time (AOT) Compilation AOT APIs
- ... oh and let's you build Microservices
- We announced Micronaut at March 2018
- Open Sourced 28th of May 2018
- Sparked improvements from Red Hat (with Quarkus) and Pivotal
- Micronaut is changing the face of server side Java
- A New Universal Virtual Machine from Oracle
- Features a
native-image
Tool- Converts Java -> native machine code using AOT
- Works well with Micronaut
- Startup time 20ms and Memory Consumption 18MB!
- GraalVM is promising and a project to keep an eye on
- Still in beta and experimental
- Micronaut optimizes for GraalVM, but also optimizes for regular Java (what most people use today)
Style | Cold Start | Memory |
---|---|---|
OpenJDK | +/- 800ms | +/- 100mb |
Eclipse OpenJ9 with Class Sharing | +/- 300ms | +/- 70mb |
Graal Native | +/- 20ms | +/- 15mb |
Style | Cold Start |
---|---|
Simple Function | +/- 300ms |
API Gateway | +/- 800ms |
API Gateway + Graal Custom Runtime | +/- 150ms |
- Micronaut and GraalVM are leading the AOT revolution
- Server Side Java is Adapting to the Serverless world
- Building more efficient applications possible with right framework choices
- AOT Sacrifices Compilation Speed to Gain so Much More
- Going native an option for the future with GraalVM