Micronaut: A lightweight framework that supports Java, Groovy and Kotlin
Looking for a new full-stack framework? Micronaut is a project brought to us by the Grails team focusing on modularity, minimal memory footprint, and a rocket-fast startup speed. Learn more about this exciting project in development today!
Did you miss Greach 2018? No worries – we have the scoop on the latest news from the newest Grails project, Micronaut. This full-stack framework is lightweight and a modern, JVM-based architecture for building modular, easily testable microservice applications.
Micronaut is specially built to run on AWS Lambda with its minimal memory footprint and speedy startup time. With Micronaut, your application startup time and memory consumption is not tied to the size of your codebase.
Designed from the group up with microservices and the cloud in mind, Micronaut is a powerful yet lightweight framework for developing microservices.
Like Spring, but faster
Micronaut’s main advantage is its speed. A server written in Java requires less than one second to start, with a minimal JAR size of 8 MB. That’s fairly impressive.
How small is Micronaut? This small:
- JAR files
- 8MB in Java
- 12 MB in Groovy
- Spring and Groovy – 36MB
- Grails – 27 MB
- Heap size
- 7MB in Java
- 19 MB in Groovy
- Spring and Groovy – 33 MB
- Grails – 49 MB
- Startup time
- Java ~1 second
- Spring / Grails ~3-4 seconds
Micronaut handles all of the information at compile time using the Groovy AST transformation or the AST processors for Java and Kotlin. This foundational support for Java, Groovy, and Kotlin allows developers more options to build the perfect microservice applications. Annotation metadata is created at compile time, not before. It’s reflection free, with absolutely zero reflection data caching. All of this put together means one speedy framework.
Additionally, there are no runtime penalties for holding metadata for configuration or dependency injection. Basically, it’s like Spring, but without any runtime reflection. The code looks fairly similar to Spring Boot with Spring Cloud enabled. It also uses an internal dependency injection inspired by Spring.
Unsurprisingly, Micronaut does share some heavy similarity to the Grails project. For instance, you can run GORM from within your Micronaut microservice.
Micronaut also offers a number of features as a HTTP client and server. Seamless load balancing is available for both. Micornaut is reactive and service discovery aware as well as fault tolerant for HTTP clients. As a HTTP server, it offers out of box support for Hystrix, trace logging, caching, and circuit breaker patterns.
How to get Micronaut
Sadly, Micronaut is currently not available for a wider release. However, companies interested in beta access should contact the OCI for an early test drive of this interesting new framework. In the meantime, Micronaut is due to be released at the end of May as part of Gr8Conf EU. We’ll keep you posted for any updates!
More information about Micronaut can be found here, or from this excellent presentation by Alvaro Sanchez-Mariscal.