class MyClass {
static Random random = new Random();
...
}
)
Max Rydahl Andersen
@maxandersen
Reduce classes needed to load
Use Build time info to discard runtime need
Example: Only load Hibernate Dialects as needed, Don’t load configuration at runtime, …
1 bean = 3 generated classes
Big app with some unused beans = waste of time and memory
Everything, except beans that…:
…are @Named
…have an observer method (@Observes
)
…are annotated with @Unremovable
…are excluded via quarkus.arc.unremovble-types
config
…are identified by Quarkus Extensions
Less classes loaded, faster startup, less memory used
Lookup using CDI.current()
not detectable.
Solution:
Use @Unremovable
or unremovable-types
config
Turn removal off with: quarkus.arc.remove-unused-beans=false
Quarkus initializes all classes at build time = faster startup
You or some "bad" library might have static init
class MyClass {
static Random random = new Random();
...
}
Don’t do static init!
@Observes StartupEvent
and @Startup
bean
Lazy initialization
Write Quarkus Extension to handle it
We went from 50(!) seconds startup with our previous used framework. To just 2-3 seconds with Quarkus in JVM mode and 15ms in native mode with GraalVM.
Today it is hard as libraries assume runtime init of all statics
Quarkus give glimpse of future using GraalVM substitutions (raw speed!)
Expect Project Leyden or similar to introduce true static init in Java
quarkus dev
A Special run mode
Can use full power and memory as dev need
Hot-reload on incoming requests
Change method, classes, packages, dependencies, …
Restart in less time than you will notice
With quarkus dev
services based on your classpath/extension list
But only IFF they are not configured
Evergrowing list of supported services
Press 'r' in quarkus dev
or Run standalone
Smart continuous test execution
While you write code
quarkus dev
?Developers actually get to use it!
Configuration can be changed at/after startup
All Beans are available to lookup
static blocks run at startup
I have to restart my app to see changes
I have to setup my own testing infrastructure
I have to write tests first
Quarkus is supersonic and subatomic Java
Developers get to have joy
Operations gets resources
Customers get what they need faster
Because we broke some eggs!
Try quarkus.io