(Software Architect series) Communication in Microservices Architecture

Communication is one of the biggest challenges in Microservice architecture. However, we should try to reduce communication between the microservices. Because it has possibility of failure. It is better to have minimum number of communications between services. Nevertheless, dependencies between services is inevitable. That is why we should carefully determine how the services talk each other, otherwise it can affect each other and results a bad performance.

Photo by Alex Andrews from Pexels

There is a design principle that promoted by microservice community, called “Smart endpoints and dumb pipes”. It really concerns on how microservices is related as decoupled as possible.

In the microservice architecture, we should use asynchronous communication protocol. Because we have to ensure that operation in a service should not be blocked by the process in other service. Since it will cause a bottle neck.

Here are some styles how asynchronous communication can be achieved.

  1. Request – asynchronous response
    • A request is sent and expects a response eventually
  2. Publish – subscribe
    • A request is published to zero or more recipients
  3. Publish – asynchronous response
    • A request is published to one or more recipients, some of them give response
  4. Notifications
    • A request is sent, but does not expect a reply

Tinggalkan komentar