Friends of OpenJDK Today

Top 7 Java Microservices Frameworks

May 29, 2024

Author(s)

  • Rob Austin

    As a Java developer with more than 20 years of experience, primarily on trading systems for investment banks, he has mostly focused on performance-critical pricing systems. As one of the ... Learn more

History of Microservices

The concept of microservices has its roots in Service Oriented Architecture (SOA), which was prominent in the early 2000s. However, the term "microservices" itself didn't appear until around 2012, when it started being discussed at software architecture events and on software architecture blogs.

Early pioneers of microservices include companies like Netflix, Amazon, and eBay. For instance, in 2009, Netflix started to transition from a monolithic architecture to a microservices architecture to better handle their rapidly scaling customer base. Other major companies followed, realizing that the monolithic architecture model had limitations when dealing with large-scale, complex systems.

Microservices have since grown increasingly popular, with many organizations adopting them as part of their software development and deployment practices. The adoption of cloud computing has also been a driving force for microservices, as it provides the infrastructure necessary to build and deploy individual services independently.

Reasons to Use Microservices

  • Scalability: One of the most significant benefits of microservices is their ability to scale independently. In a monolithic system, if one function requires more resources, the whole system must be scaled. However, in a microservices architecture, only the necessary services need to be scaled.
  • Resilience: If a component in a monolithic architecture fails, it can cause the entire system to crash. With microservices, however, if one service fails, it doesn't necessarily bring down the whole system, making them a more resilient choice.
  • Faster Deployment and Updates: Since each microservice can be deployed independently, updates and new features can be rolled out faster and more safely. If a new feature causes an issue, only the microservice containing that feature will be affected.
  • Flexibility in Technology Stacks: Each microservice can be developed using the technology best suited to its requirements. This means teams can choose the best tools for their specific tasks, rather than being limited by the needs of the entire system.
  • Optimized for Continuous Integration and Delivery (CI/CD): Microservices align well with modern development practices like CI/CD, allowing for efficient, ongoing code integration, testing, and deployment.
  • Easier Maintenance and Debugging: Microservices are smaller and more focused, making them easier to understand and debug compared to a large monolithic codebase.

However, it's important to note that microservices are not a silver bullet. They also come with challenges, like the need for robust service coordination, data consistency, and increased complexity. Hence, it's crucial to understand the trade-offs and ensure they are the right fit for your specific context before moving ahead with a microservices architecture.

Java is one of the most popular languages used for building microservices due to its robust ecosystem, strong developer community, and compatibility with containerization and orchestration tools. Here are seven of the most popular frameworks in Java for building microservices:

1. Quarkus

Quarkus is a full-stack, Kubernetes-native Java framework tailored for GraalVM and HotSpot, and crafted from leading Java libraries and standards. Its key promise is to make Java a leading platform in Kubernetes and serverless environments, offering developers a unified reactive and imperative programming model.

Key Benefits of Quarkus:

  • Developer Productivity: Quarkus boasts a development mode that offers live coding and hot reload capabilities, significantly enhancing developer productivity. Changes to the application are automatically reflected in the running application without needing a restart.
  • Fast Boot Time & Low Memory Consumption: Quarkus makes extensive use of Graal technology for AoT compilation and native images to achieve fast startup times and low memory footprint. This is especially useful for functions-as-a-service execution environments that require fast startup times and could scale down to zero when idle.
  • Standards-Based: Quarkus supports a wide range of application development models and features like CDI, RESTEasy (JAX-RS), Hibernate ORM (JPA), and more.
  • Kubernetes-Native: Being designed as a Kubernetes-native framework, Quarkus simplifies the process of deploying and managing applications on a Kubernetes cluster.
  • Large Ecosystem: Quarkus supports a broad range of libraries and frameworks through its extension model, such as Apache Kafka, GraphQL, and more.
  • Reactive and Imperative Programming: Quarkus supports both reactive and imperative programming models, providing flexibility to developers to choose the best model according to their use case.
  • Enterprise Support: As Quarkus is a Red Hat sponsored project, it has solid enterprise-level support, making it a reliable choice for businesses.

Potential Drawbacks of Quarkus:

  • Relative Newcomer: Compared to established frameworks like Spring Boot, Quarkus is a relative newcomer, however it comes with a large amount of documentation .
  • Limited Extensions: While Quarkus does have an extension model, it may not support all libraries and frameworks, especially some niche or less commonly used ones.
  • Learning Curve: If developers are not already familiar with the libraries and standards used by Quarkus, there could be a learning curve.

2. Spring Boot

Spring Boot is a project built on top of the Spring Framework. It provides a simpler and faster way to set up, configure, and run both simple and web-based applications. It's a very popular choice for creating microservices in Java.

Key Benefits of Spring Boot:

  • Rapid Development: Spring Boot offers an opinionated approach to application development, with a focus on reducing the time and effort required for setting up a new project. This allows developers to start coding right away without worrying about configurations. Popular initializer toolkit which has formed the basis for many similar tools in other projects.
  • Autoconfiguration: Spring Boot offers automatic configuration based on the libraries present on the classpath, which means less manual configuration is needed.
  • Embedded Server: With Spring Boot, you don't need to deploy your application to a web server, as it comes with embedded servers like Tomcat, Jetty, or Undertow, simplifying the deployment process.
  • Spring Ecosystem: Spring Boot integrates smoothly with the wider Spring ecosystem, including Spring Data, Spring Security, Spring Integration and Spring Batch, making it easier to include these functionalities in your application.
  • Microservice Components: Evolved from Netflix microservice work, including API Gateway, Service Discovery, Circuit-breaker.
  • Cloud Native: Extensive support for building cloud-native applications, through generic libraries and also specific support for different cloud providers. Also interface to Kubernetes orchestration.
  • Large and Active Community: The Spring Boot community is very active and large, which means it's easier to find help, resources, and libraries when needed.
  • Performance Metrics: Spring Boot Actuator provides essential production-ready features out of the box, without having to implement these features yourself.
  • Testability: It provides strong support for testing, including specific test annotations and TestRestTemplate for integration tests.

Potential Drawbacks of Spring Boot:

  • Learning Curve: Spring Boot, while simplifying a lot, requires a fair bit of Spring knowledge. There might be a steep learning curve if you're not familiar with the Spring ecosystem.
  • Memory Consumption: Spring Boot applications can consume more memory than applications built with some other lightweight frameworks or toolkits.
  • Less Mature in AoT and Native Image: Not so well developed as Quarkus in these areas but much effort and it is catching up.
  • Auto-Configuration Can Be Too Broad: In some cases, Spring Boot’s automatic configuration might not fit your exact needs and can be challenging to override.

In conclusion, Spring Boot is a great choice for building standalone, production-grade applications that you can "just run". Its vast ecosystem, combined with the convenience of convention over configuration, makes it a leading choice for building microservices with Java.

However, like any technology choice, its suitability will depend on your specific use cases and requirements.

3. Micronaut

Micronaut is a modern framework that advertises itself as an alternative to Spring Boot. Lead developers were involved in the development of Graal, and Micronaut uses this knowledge to deliver performance advantages over Spring Boot. It uses ahead-of-time compilation combined with an approach to IoC that is not based on reflection to offer extremely low memory usage and fast startup times.

Key Benefits:

  • Greatly reduced memory consumption compared to Spring
  • Very fast startup time improves dev/test cycle efficiency
  • Ahead-of-Time compilation detects DI errors at build time
  • Supports multiple languages including Java, Groovy, Kotlin
  • Integrates with GraalVM for ahead-of-time compilation

4. Helidon

Helidon is a set of Java libraries for writing microservices, presented by Oracle. It offers two programming models: Helidon SE, a reactive, non-blocking API style; and Helidon MP, which implements MicroProfile for developers familiar with Java EE.

Key Benefits of Helidon:

  • Lightweight and Fast: Helidon is designed to be simple and lightweight, with a small memory footprint, which contributes to faster startup times and better performance compared to more bloated frameworks.
  • Flexible Programming Models: Helidon offers two distinct programming models: Helidon SE for a functional programming approach and Helidon MP for a declarative, annotation-based approach.
  • Observability: Helidon has built-in support for health checks, metrics, and tracing, which are vital for observing the state of your microservices.
  • Native Integration with Oracle Cloud Infrastructure: Being an Oracle product, Helidon provides seamless integration with Oracle Cloud Infrastructure services, which can be a big plus if you're an OCI customer.
  • Ease of Deployment: Helidon applications are just standalone Java programs, which simplifies deployment. They can also be packaged in Docker containers and deployed to Kubernetes.
  • Support for GraalVM: Helidon supports GraalVM, which can be used to compile Java applications into native executables for even faster startup times and lower runtime memory overhead.

Potential Drawbacks of Helidon:

  • Community and Support: As a relatively new player in the field, Helidon doesn't have as large a community as more established frameworks like Spring Boot. This might mean fewer resources, less third-party integration, and fewer people to ask for help.
  • Learning Curve: If you're not already familiar with reactive programming or MicroProfile, there might be a learning curve to get started with Helidon SE or Helidon MP respectively.

In conclusion, Helidon is a promising new entry into the microservices framework landscape, particularly for those who prefer a reactive, non-blocking programming model or a MicroProfile-based approach.

Its tight integration with Oracle Cloud Infrastructure could make it an excellent choice if you're already using or planning to use Oracle's cloud services.

As with any technology choice, its suitability will depend on your specific use cases and requirements.

5. Chronicle Services

Chronicle Software's microservice framework, called Chronicle Services, is a low latency Java framework designed to build high-performance, distributed applications.

They are particularly favored in finance and trading environments where performance, simplicity, and reliability are critical.

Key Benefits:

  • Low Latency: Chronicle Services are designed for scenarios where high-speed processing is a must, such as financial trading systems.
  • High Performance: Due to their efficient design, Chronicle Services can handle a large number of transactions per second, making them suitable for high-throughput systems.
  • Distributed Systems: They provide built-in support for creating distributed systems, allowing individual components to work together across a network.
  • Simplicity and Ease of Development: Chronicle Services are designed with a focus on simplicity, offering a clean and intuitive API. This, coupled with comprehensive documentation, makes the development process smoother and faster.
  • Testability: With built-in support for unit testing and integration testing, Chronicle Services make it easier to maintain the reliability and integrity of your software as it evolves.
  • Persistence and Monitoring: It provides powerful tools for data persistence and system monitoring, essential for maintaining the health of a distributed system.
  • Developer Flexibility: They offer a good deal of flexibility, allowing developers to implement custom solutions tailored to their specific needs.

Potential Drawbacks

  • Lack of Community and Resources: Compared to other, more established, frameworks like Spring Boot, Chronicle Services has a smaller community and fewer readily available resources, tutorials, and guides.
  • Limited Compatibility: While it offers considerable flexibility, it might not have out-of-the-box compatibility with certain popular libraries and frameworks, which might lead to additional development.
  • Cost: Chronicle Software is a commercial organization, and while some components are open-source, using the full suite of Chronicle Services will involve licensing costs.

The focus on high-performance computing makes it an excellent choice for applications that need to process a large number of transactions per second. It provides a robust set of tools for building distributed systems, ensuring efficient data persistence and system monitoring.

Despite some challenges, such as a smaller community and a learning curve, the benefits it offers can far outweigh these considerations in performance-critical applications. Moreover, its commercial backing by Chronicle Software ensures dedicated support and ongoing improvements.

For organizations requiring high performance and the capability to manage the complexities of migrating to microservices and the cloud, Chronicle Services is a good choice. While traditionally focused on trading systems, Chronicle Services is branching out to other markets. It is a fantastic technology choice.

6. Vert.x

Vert.x is an event-driven, non-blocking, reactive toolkit for developing applications on the Java Virtual Machine (JVM). It's designed to handle high concurrency with ease, making it well-suited for microservices architecture.

Key Benefits:

  • Event-Driven and Non-Blocking: Helps create scalable microservices by effectively handling concurrent requests.
  • Polyglot: Supports multiple JVM-based languages like Java, Kotlin, Groovy, and Scala, providing flexibility in the choice of language.
  • Lightweight and High Performance: Provides a lightweight, high-performance alternative to traditional Java frameworks.
  • Distributed Event Bus: Facilitates communication between components with simple pub-sub messaging.
  • Developer-Friendly: Offers features like live coding and hot reload for a joyful development experience.
  • Supported by the Eclipse Foundation: Ensures stability and ongoing improvements.

There are numerous choices available for creating microservices in Java. It's important to evaluate key priorities such as performance, developer productivity, operational management, and ecosystem compatibility to find the best fit.

7. Kalix.io

A newcomer to the marketplace, from Lightbend. Can be seen as an evolution of their previous microservice platform Lagom, and Web application platform Play. Built on Akka, an actor based model for fast communications between processing units, which has been widely used in other areas.

Kalix is a commercial product, offering PaaS for building and running cloud native applications. Their main selling point is that developers concentrate on business logic and leave everything else to Kallix. A small number of relatively high level abstractions are provided: Entity, Action, Workflow and View.

Applications can be built and tested locally, and then deployed to the runtime platform hosted on the Cloud Provider of choice. Costs are calculated based on usage of underlying resources, a free trial period is offered, follwed by a choice of pricing plans from pay-as-you-go through to secure sandbox based deployment on GCP and AWS.

Kalix claims attractive performance stats:
Read latency 6ms @ 1000 tps, 12ms @ 15000 tps (99%ile)
Write latency 8ms @ 1000 tps, 20ms @ 15000 tps (99%ile)

Key benefits:

  • Focussed on cloud-native apps from the start
  • Development environment aimed at reducing time to market
  • Horizontal scalability based on well-used Akka approach
  • Built-in security
  • Multiple languages supported (Java, Javascript, Typescript, Scala)
  • Managed platform for production, including SREs, DevOps and DB Admins
  • Usage based pricing

Potential drawbacks:

  • New to the market, so unproven (although underlying tech is widely used)
  • Not open source, so more limited community
  • Not really suitable for non-cloud based usage

Related Articles

View All

Author(s)

  • Rob Austin

    As a Java developer with more than 20 years of experience, primarily on trading systems for investment banks, he has mostly focused on performance-critical pricing systems. As one of the ... Learn more

Comments (1)

Your email address will not be published. Required fields are marked *

Highlight your code snippets using [code lang="language name"] shortcode. Just insert your code between opening and closing tag: [code lang="java"] code [/code]. Or specify another language.

Save my name, email, and website in this browser for the next time I comment.

Java Weekly, Issue 545 | Baeldung

[…] >> Top 7 Java Microservices Frameworks [foojay.io] […]

Subscribe to foojay updates:

https://foojay.io/feed/
Copied to the clipboard