How do microservices collaborate and interact?

5G Core, Telco-Cloud

A Cloud native application is made from multiple microservices and for proper functioning of the application all the microservice needs collaborate and interact with each other for information exchange.

We may have question in mind, how do these microservices collaborate and interact with each other? So basically, there are two ways namely 𝐨𝐫𝐜𝐡𝐞𝐬𝐭𝐫𝐚𝐭𝐢𝐨𝐧 and 𝐜𝐡𝐨𝐫𝐞𝐨𝐠𝐫𝐚𝐩𝐡𝐲 followed by the microservices for the interaction with each other.

Choreography is like having a choreographer, who set all the rules. Then the dancers on stage (the microservices) interact according to him. Service choreography describes this exchange of messages and the rules by which the microservices interact. The diagram below illustrates the collaboration of microservices using choreography method.

Orchestration is different. The orchestrator acts as a center of authority. It is responsible for invoking and combining the services. It describes the interactions between all the participating services. It is just like a conductor leading the musicians in a musical symphony. The orchestration pattern also includes the transaction management among different services.

The benefits of orchestration:

  • Reliability – orchestration has built-in transaction management and error handling, while choreography is point-to-point communications and the fault tolerance scenarios are much more complicated.
  • Scalability – when adding a new service into orchestration, only the orchestrator needs to modify the interaction rules, while in choreography all the interacting services need to be modified.

Some limitations of orchestration:

  • Performance – all the services talk via a centralized orchestrator, so latency is higher than it is with choreography. Also, the throughput is bound to the capacity of the orchestrator.
  • Single point of Failure – if the orchestrator goes down, no services can talk to each other. To mitigate this, the orchestrator must be highly available.

Related Posts: