Microservices Reference Architecture - with Spring Boot, Spring Cloud and Netflix OSS
Image courtesy of jumpe at FreeDigitalPhotos.net

Microservices Reference Architecture - with Spring Boot, Spring Cloud and Netflix OSS

What is "Microservices"?

Microservices is the "new kid" on the block; a new paradigm that seeks to replace monolithic enterprise applications with a suite of small services that use lightweight mechanism like REST to communicate with each other. These services are built around business capabilities and independently deployable by fully automated deployment machinery.

The crux of microservices can be epitomized by this illustration as defined by Martin Fowler.

Frameworks

 There are couple of frameworks available in different software ecosystems that make it easy to create distributed applications using microservices architecture.

  1. Java - Spring Cloud using Netflix OSS
  2. Node.js - Seneca

The reference architecture developed by us builds on the Spring Cloud ecosystem.

There are number of components available within the Spring Cloud and Netflix OSS ecosystem that solve common problems for distributed applications (e.g. configuration management, service discovery, circuit breakers, intelligent routing etc).

Target Architecture and Components

The application consists of 8 different services that are available in Synerzip GitHub repository.

 

  1. config-server - setup external configuration
  2. webservice-registry - Eureka server
  3. auth-server - OAuth2 authorization server
  4. user-webservice - User microservice
  5. task-webservice - Task microservice
  6. comments-webservice - Comments for task microservice
  7. api-gateway - API gateway that proxies all the microservices
  8. web-portal - Single Page Application that provides the UI

 

All the different services lend themselves to the following target architecture.

 

While there are existing samples available for using the different Spring cloud/Netflix OSS components, we did not find anything that merged all of them together to provide an enterprise architecture. Additionally the documentation is sporadic and widely distributed so it becomes hard to understand how the components interact with each other.

 

This reference architecture can be used as a starting point to understand the Microservices paradigm and then expand to scale to your architecture needs.

Considerations for building production-ready systems

 

The thought process for the reference architecture revolved around 2 concepts

  1. Making it easy enough so that beginners can understand
  2. Making it complete enough so that it can serve as the starting point of enterprise applications.

 

When you are ready to build your application with this reference architecture, keep the following things in mind

 

  1. The application uses an endpoint to check if the user is authenticated; this leads to a very chatty application. When building your system instead use the Json Web Token (JWT) wherein the token itself contains enough information for the resource server to do simple user authentication.
  2. The Single Page Application that provides the UI is part of the reference architecture, whereas applications might be better off having the SPA as separate application that just needs to interact with your distributed system and not be part of the distributed system.
  3. There are additional Netflix OSS components like Turbine, Feign and SideCar that might be applicable to your architecture.

Codebase

  1. https://github.com/Synerzip/spring-boot-microservices
  2. https://github.com/anilallewar/sample-config 

Please NOTE that the repository referenced in this article is NO longer being actively maintained and is out-of-sync with the latest Spring Boot and Spring Cloud releases. Please fork the below repository for the latest changes. https://github.com/anilallewar/microservices-basics-spring-boot Additional features added to the new repository 1. Changes for supporting Spring OAuth2 when it moved from Spring cloud to Spring boot in 1.3 version 2. Docker - building services as containers and orchestrating them using various mechanisms 3. Implementation for consumer driven contracts (CDC) and distributed tracing 4. Bug fixes

Like
Reply

market demand especially in Indo or sea region ?

Like
Reply
Lutfi Hidayat

Engineering @ Rakuten

8y

Already built one in current company. The hardest part i think is in designing the architecture, don't let it become the spider web

Like
Reply
Hendranto Nugroho

Microservices Advisor at Private Company

8y

good start to learn microservices

Like
Reply

Good overview on microservices...

Like
Reply

To view or add a comment, sign in

More articles by Anil Allewar

  • How do we test Microservices?

    The Microservices paradigm is now firmly entrenched in software development with almost all companies using it to be…

    1 Comment

Others also viewed

Explore content categories