Search:

Microservice Decomposition Strategy

Most of the developers are interested in microservice architecture and tries to taste them. But it is not a trivial problem to develop and migrate enterprise products to microservice architecture.

One challenging problem in microservice architecture is how to decompose the microservices. The questions of “how micro services?”, “microservices or nanoservices?” would be pointing to the same problem.

First, Whether or not microservice architecture is used, Domain Driven Design would be helpful in order to determine the domain and the resources.

Secondly, just like the layered architecture (repository, business, presentation etc.) in monolith systems, there should be separations among microservices. Some microservices should represent and persist data, some should use the data that others persisted, some should aggregate and present them.

Here are our microservice decomposition types,

 

  • Entity Services: These types of services are persisting and representing data. These are similar to the repository layer of the monolith architectures. These services should preferably represent the data that they hold with RESTful API’s. These RESTful API’s should be standard and should have paging, sorting, filtering supports. (Just like the repositories in monolith architectures). Here are the examples,

    • User service

    • Product Service

 

  • Capability Services: These services do not represent any data. They may either use the data represented by entity services and apply the business logic or they may responsible for managing operations related with the third parties.

    • Login Capability Service: Uses the data represented by User Service above.

    • Bank Gateway Capability Service: Uses the data from an internal entity service (ex. Cart Service) and external third party (Bank API).

 

  • Query Services: Entity services may not be sufficient in order to handle the complex queries, such as web pages containing data grids, which consist of more than one entity. Just like the views in RDBMS, which are commonly used in monolith architectures, query services helps solving complex aggregations when retrieving data.

Get in touch