Microservice Orchestration Vs Choreography

On

The microservice architecture is a collection of small services with each service having a specific function. These service modules can’t perform well in isolation and need some kind of medium so that they interact and share data.

This leads us into one question: How to stitch these service modules together?

There are two ways to do it: Microservice Orchestration and Microservice Choreography. We will talk about both in detail.

Let’s have a quick peep into:

Microservice Orchestration vs Choreography

What is Microservice Orchestration?

In an orchestra, we have a central man called the “orchestrator”. Therefore, he is responsible for invoking all the sounds.

Similarly, in the microservice orchestration, the orchestrator (central controller) handles all the microservice interactions. It transmits the events and responds to it.

The microservice Orchestration is more like a centralized service. It calls one service and waits for the response before calling the next service. This follows a request/response type paradigm.

Orchestration Benefits

  1. Easy to maintain and manage as we unify the business process at the center.
  2. In synchronous processing, the flow of the application coordinates efficiently.

Limitations

  1. Creating dependency due to coupled services. For example, if service A is down, service B will never be called.
  2.  The orchestrator has the sole responsibility. If it goes down, the processing stops and the application fails.
  3. We lose visibility since we are not tracking business process.

response/request paradigm

 

What is Microservice Choreography?

choreography/belle dance

It is the other way to achieve microservice interaction.

We want to avoid dependencies in a microservice architecture. So, that each service can work independently. Choreography solves this issue which was the main challenge in orchestration approach.

You can imagine Microservice Choreography as a belle dance (as shown in the above picture). In it, every individual performs steps independently.

Similarly, in microservice Choreography, every microservice performs their actions independently. It does not require any instructions. It is like the decentralized way of broadcasting data known as events. The services which are interested in those events, will use it and perform actions. This is also known as reactive architecture. The services know what to react to, and how-to, which is more like an asynchronous approach.

Benefits

  1. Enables fast processing. As no dependency on the central controller.
  2. Easy to add and update. The services can be removed or added anytime from the event stream.
  3. As the control is distributed, there is no single point failure.
  4. Works well with the agile delivery model, as teams work on certain services rather than on entire application.
  5. Several patterns can be used. For example, Event sourcing, where events are stored, and it enables event replay. Command-query responsibility segregation (CQRS) can separate read and write activities.

Limitations

  1. Complexity is the concerning issue. Each service is independent to identify the logic and react based on the logic provided from the event stream.
  2. The Business process is spread out, making it difficult to maintain and manage the overall process.
  3. Mindset change is a must in the asynchronous approach.

Most of the times, these approaches don’t work well in architecture. So, what is the solution in these use cases?

The answer is Hybrid

That is to say, the hybrid approach can solve the problem. For example, if we have a mix of synchronous and asynchronous blocks of activity. So consequently, one or more hybrid pattern can add value to the projects.

Hybrid is the combination of the orchestration approach and choreography. In this approach, we use orchestration within the services whereas we use choreography in between the services.

A Hybrid approach like others is two-edged. Let’s discuss:

Benefits

  1. The Overall flow is distributed. Each service contains its flow logic.
  2. Services are decoupled (but to an extent).

Limitations

  1. The coordinator is coupled with the services.
  2. If the coordinator goes down, it impacts the entire system.

 

In short, all the approaches have their benefits and trade-offs.

as the saying is “one can’t make eggs without breaking them”.

 

In a Nutshell

Microservice Orchestration and Choreography are two different modes of interactions. Orchestration uses a centralized approach to execute the decisions and is more crystal clear and has better control. However, Choreography gives more freedom to execute those decisions. On the other hand, we can use both by adopting a hybrid approach to get better results.

So, you can choose from these approaches according to the demands of your architecture.

Related Posts

Microservice Architecture: An Independent Approach to Software Development
Microservice Architecture: An Independent Approach to Software Development

Microservice Architecture: An Independent Approach to Software Development

Skepticism by communities in software development dismisses Microservices architecture as nothing new, just an overhaul of the old SOA (service-oriented architecture). Despite all the uncertainties, …

5 reasons why companies are moving to Microservices Architecture
5 reasons why companies are moving to Microservices Architecture

5 reasons why companies are moving to Microservices Architecture

The microservice architecture is like a honeycomb. “Have you ever seen a honeycomb?” Well, not from close. From far off even, we can visualize the hexagonal paradigm …

Why your business needs Progressive Web Apps?
Why your business needs Progressive Web Apps?

Why your business needs Progressive Web Apps?

One of the major concerns that businesses have nowadays is that whether they should have an app or a website. This is not just a …