What is Orchestration and Choreography in micro-services ?

Orchestration is the automated configuration, coordination, and management of computer systems and software. Application or service orchestration is the process of integrating two or more applications and/or services together to automate a process, or synchronize data in real-time.

In Orchestration, we rely on a central system to control and call other Microservices in a certain fashion to complete a given task. The central system maintains the state of each step and sequence of the overall workflow.

Let’s say we want to develop a microservice that will send email about product recommendation in a fictitious e-shop. In order to send recommendations, we need to have access to user’s order history which lies in a different microservices.

In Orchestration approach, this new microservice for recommendations will make synchronous calls to order service and fetch the relevant data, then based on user’s past purchases we will calculate the recommendations. Doing this for a million users will become cumbersome and will tightly couple the two microservices.

In Choreography approach, we will use event-based asynchronous communication where an event will be published by order service whenever a user makes a purchase. Recommendation service will listen to this event and start building user recommendation. This is a loosely coupled approach and highly scalable. The event, in this case, does not tell about the action, but just the data.

Thanks for reading.

Leave a Comment