Scroll Top

Micronaut – The potential poster boy for Microservices

Problem Statement

I think it is not an exaggeration if I say we are living in the age of Microservices. Microservices became de facto architecture pattern for every new enterprise scale application that is being implemented and many existing monolithic applications are getting migrated into Microservices. In the case of Java world, Spring Boot turned out to be the standard framework to develop Microservices. There were some other frameworks like DropWizard, Apache Karaf, and Jersey. But they were not able to give tough competition to Spring Boot and slowly their usage percentage came down and became insignificant over a period of time.  If you observe the evolution of Spring Boot, initially it was not proposed as Microservices solution from Spring. It was initially proposed and implemented as the containerless web application and developer community started using it for Microservices implementation. But Spring Boot got its own limitations like:

  • Fixed single language
  • Lack of Inbuilt support for data accessing
  • Lack of Simpler unit testing
  • Lack of Inbuilt service discovery
  • Lack of Inbuilt load balancing

We need explicit configuration which can be achieved through the cloud services instead of having the built-in support within the framework itself.

Here comes Micronaut which contains the aforementioned features inbuilt and designed with single and primary intent to serve as the vehicle for Microservices development.

What is Micronaut?

Micronaut is a JVM based modern full-stack Microservice framework. This new framework has been developed by Grails team with an intention to solve problems which have been identified over the years while building the real world Microservices applications.

Key highlights of Micronaut:

Micronaut by default provides all the required tools to build the fully featured Microservices applications, which includes:

  • Dependency Injection and Inversion of Control (IoC)
  • Sensible Defaults and Auto-Configuration
  • Configuration and Configuration Sharing
  • Service Discovery
  • HTTP Routing
  • HTTP Client with client-side load-balancing

In Parallel, Micronaut also aims to avoid the downsides of Spring framework, Spring Boot and Grails frameworks by providing:

  • Fast startup time
  • Reduced memory footprint
  • Minimal use of reflection
  • Minimal use of proxies
  • Easy unit testing

Currently existing frameworks like Grails, Spring were not designed to run in the use cases such as Android Apps, low memory-footprint Microservices, serverless functions but Micronaut designed to address the above scenarios and it is perfectly suitable.

Micronaut achieved this goal by using the Java’s annotation processors, these annotations are usable on any JVM based language.  In Micronaut, Java’s annotation processors will precompile the necessary metadata to perform dependency injection, defines the AOP proxies and also configure your application to run in the Microservices environment.

Micronaut framework is extensively inspired from positive aspects of Spring and Grails and improved upon not so good aspects like the above-listed limitations in the problem statement. This is by the design and it aids developers to come up to the speed quickly.

Salient Features:

In this section,  I will be discussing the salient features of the Micronaut framework:           

FAST STARTUP TIME — LOW MEMORY CONSUMPTION

Applications which are implemented by using the Micronaut won’t depend on the size of the codebase, so application startup time and memory consumption are less. But in other reflection-based IoC frameworks, they load and cache reflection data of every single field, method, and constructor.

CHOOSING A LANGUAGE

Micronaut supports popular below three programming languages, we can use any programing language to build the APIs

EFFICIENT COMPILE – TIME DEPENDENCY INJECTION AND AOP

Micronaut by default provides the simple compile-time aspect-oriented programming API that does not use any kind of reflection.

BUILD FULLY REACTIVE AND NON-BLOCKING APPS

Micronaut by default supports any framework that implements Reactive Streams, including RxJava, and Reactor.

NATIVELY CLOUD NATIVE

Micronaut has the built-in support for Cloud, it includes support for common service discovery and distributed tracing tools, cloud runtimes.

  • AWS
  • Google Cloud Platform
  • Netflix Eureka
  • Zipkin – distributed tracing system
  • JAEGER – open source, end-to-end distributed tracing

 

READY TO DEVELOP SERVERLESS APPLICATIONS

By using Micronaut, we can easily write the functions for serverless environments such as AWS Lambda service because of less overhead compile-time Dependency Injection and Aspect Oriented Programming.

 

DESIGNED FOR BUILDING RESILIENT MICROSERVICES

In a distributed Microservice environment, it is always recommended to have a better planning to handle the failures. As a microservice framework, Micronaut has the built-in support to retry when a particular service is down by using the Circuit Breaker, still the services are down after the specified number of attempts then fallbacks will help you to plan better.

FAST DATA-ACCESS CONFIGURATION

Micronaut also has the built-in support for the defaults that automatically allow configuring your favourite data access toolkit and the APIs to make it easy to write your own integrations.

  • MongoDB
  • Hibernate
  • Cassandra
  • Redis
  • Neo4j
  • SQL

 

Summary

With all the features that Micronaut is providing, I am very optimistic that it will make API development simpler and faster. This framework is appearing like a potential poster boy for Microservices going forward. Let us hope and wish it will perform on par with our expectations.

References

http://micronaut.io/

https://docs.micronaut.io/latest/guide/index.html

Related Posts

Leave a comment

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.