Microservices?

Microservices architecture

Arranges an application as a collection of loosely coupled services. In a microservices architecture, services are fine grained, and the protocols are light weight.

Microservice

The services that make up the distributed application in a Microservice architecture are referred to as a Microservice. A Microservice is a self contained unit built to realize a specific business capability. Illustration below depicts the examples of business capabilities in the banking and eCommerce domains.

capability-microservice-mapping.png

It is important to keep in mind that the relationship between business capability and microservices is not 1:1. A business capability may be realized by 1 or more microservices.

Domain Driven Design (DDD)

Since Microservices are organized around business capabilities, discovering the optimal domain boundaries is essential to ensure independent nature of the service.

Bounded Context

Is a logical construct or an architectural artifact that identifies the business capability boundaries. You may think of boundary as the area of responsibility for the microservice. E.g., in the illustration above:

  • Shipping microservice is responsible for business processes related to shipping only

  • Loans microservice is responsible for realization of only loans related business capability

Microservice contracts

All interactions between microservices are via well-defined contracts. Each microservice exposes interfaces that other microservices can use for interaction. Consider the illustration:

  • Orders service is responsible for customer order in-take. When order is successfully processed, the service invokes the Ship order interface (think API) exposed by the Shipping service

  • Shipping service is responsible for the shipping of the orders to customer. When order is shipped, shipping service invokes the Update status interface on order service

These interactions will break if the interface definitions are changed. The internal implementation of the interface does not matter as long as the interface stays the same.

interactions.png

Microservice Architecture Realization

The illustration below depicts a typical process for building microservices architecture. It is important to understand that Domain Driven Design is a pre-cursor to building a microservices architecture. The objective of DDD is to identify the

  • capabilities in a business domain
  • demarcate the areas of responsibility or boundaries for each capability

msa-realization.png