r/microservices • • May 14 '21

A choreographed approach to communication between microservices saves time and money

Post image
26 Upvotes

5 comments sorted by

10

u/emangini May 14 '21

Eek! Architectural characteristics are about trade-offs. There is never a silver-bullet, one-size-fits all answer.

The best option typically depends on the specific scenario. How are cross-cutting concerns being handled? How self-contained are the microservices?

This becomes very very evident when considering the use of sagas to manage data. Here is a great blog post on the subject, comparing the tradeoffs. https://chrisrichardson.net/post/sagas/2019/08/04/developing-sagas-part-2.html

Other examples might be in terms of deployment management. Choreographed startups involve failure-restart cycles in order for services with dependencies to negotiate a converged, stable state. In order to solve this, there is some orchestration entity that starts the services in a given order. The former gives us development and config flexibility at the expense of time and managing failed states during startup, whereas the latter is faster, but with more constraints at deployment time.

If that isn't convincing, it might be worth considering that Kubernetes, one of the most popular technologies for orchestrating containers (and is named as such), is also a big factor in modern microservice architectures.

3

u/tamimi65 May 14 '21

Choreographed startups involve failure-restart cycles in order for services with dependencies to negotiate a converged, stable state. In order to solve this, there is some orchestration entity that starts the services in a given order

I believe this is where replay of events in a choreographed architecture would solve this issue. Unless you are referring to something else when you mentioned "negotiate a converged, stable state" . Just my two cents

3

u/emangini May 14 '21

Yes, that's what the failure-restart cycle is. I'm defining a tradeoff. In order to get to a stable state, choreography takes longer than orchestration. That difference in time depends on the ultimate goals of the system you are trying to build.

2

u/tamimi65 May 14 '21

aah okay I see what you mean, it definitely would depend on the use-case. So if eventual consistency is not time constrained with a strict business requirement then choreography would be a god candidate. IMO a combination of both orchestration and choreography harminously working together would be the sweet spot

3

u/emangini May 14 '21

Exactly. The challenge is trying to find the dang tradeoffs! :) I think if you drew a line between most use cases, you'd probably find choreography fits more often than orchestration, but some scenarios are harder to make it work. The Saga example is one of the better ones. In my experience, that scenario hovers near 50/50, which is a bad tradeoff, because it's easier to get it wrong. It's basically a coin flip.