Live data from Hacker News

Microservices should form a polytree

bytesauna.com

81–90 of 121 posts

Re: Microservices should form a polytree

#82

This seems cool if all you need is: call service -> Get response from service -> do something with response. How do you structure this for long running tasks when you need to alert multiple services upon their completion? Like what does your polytree look like if you add a messaging pub/sub type system into it. Does that just obliterate all semblance of the graph now that any service can subscribe to events? I am not…

A general pub/sub bus between all the nodes does generally encourage everything to become tangled together, for sure.

Re: Microservices should form a polytree

#83
post #31

Avoiding cyclic dependencies is good, sure. And they do name specific problems that can happen in counterexample #1. However, the reasoning as to why it can't be a general DAG and has to be restricted to a polytree is really tenuous. They basically just say counterexample #2 has the same issues with no real explanation. I don't think it does, it seems fine to me.

Came here to say the same thing. A general-purpose microservice that handles authentication or sends user notifications would be prohibited by this restriction.

Re: Microservices should form a polytree

#86
post #31

Avoiding cyclic dependencies is good, sure. And they do name specific problems that can happen in counterexample #1. However, the reasoning as to why it can't be a general DAG and has to be restricted to a polytree is really tenuous. They basically just say counterexample #2 has the same issues with no real explanation. I don't think it does, it seems fine to me.

Came here to say the same thing. A general-purpose microservice that handles authentication or sends user notifications would be prohibited by this restriction.

Or DNS.

I think the article is just nonsense.

Re: Microservices should form a polytree

#87
it's only in theory, in practice not going to happen.

In most of the cases, authorization servers are called from each microservice.

evented systems loopback and it's difficult to avoid it, e.g.: order created -> charge -> charge failed -> order cancelled

Re: Microservices should form a polytree

#88
I think what the article is doing wrong is treating all microservices the same.

Microservices can be split into at least 3 different groups:

  - infrastructure (auth, messaging, storage etc.)
  - domain-specific business logic (user, orders)
  - orchestration (when a scenario requires coordination between different domains)
If we split it like this, it's evident that:

   - orchestration microservices should only call business logic microservices 
  - business logic microservices can only call infrastructure microservices
  - infra microservices are the smallest building blocks and should not call anything else
This avoids circular dependencies, decreases the height of the tree to 3 in most cases, and also allows to "break" the rule #2 in the article, because come on, no one is going to write several versions of auth just to make it a polytree.

It also becomes clearer what a microservice should focus on when it comes to resilience/fault tolerance in a distributed environment:

  - infra microservices must be most resilient to failure, because everyone depends on them
  - orchestration microservices should focus on compensating logic (compensating transactions/sagas)
  - business logic microservices focus on business logic and its correctness

Re: Microservices should form a polytree

#89

This seems cool if all you need is: call service -> Get response from service -> do something with response. How do you structure this for long running tasks when you need to alert multiple services upon their completion? Like what does your polytree look like if you add a messaging pub/sub type system into it. Does that just obliterate all semblance of the graph now that any service can subscribe to events? I am not…

I think for a lot of teams, part of the microservices pitch is also that at least some of the services are off the shelf things managed by your cloud provider or a third party.

Re: Microservices should form a polytree

#90
post #31

Avoiding cyclic dependencies is good, sure. And they do name specific problems that can happen in counterexample #1. However, the reasoning as to why it can't be a general DAG and has to be restricted to a polytree is really tenuous. They basically just say counterexample #2 has the same issues with no real explanation. I don't think it does, it seems fine to me.

Suppose we were critiquing an article that was advocating the health benefits of black coffee consumption, say, we might raise eyebrows or immediately close the tab without further comment if a claim was not backed up by any supporting evidence (e.g. some peer reviewed article with clinical trials or longitudinal study and statistical analysis).

Ideally, for this kind of theorising we could devise testable falsifiable hypotheses, run experiments controlling for confounding factors (challenging, given microservices are _attempting_ to solve joint technical-orgchart problems), and learn from experiments to see if the data supports or rejects our various hypotheses. I.e. something resembling the scientific method.

Alas, it is clearly cost prohibitive to attempt such experiments to experimentally test the impacts of proposed rules for constraining enterprise-scale microservice (or macroservice) topologies.

The last enterprise project I worked on was roughly adding one new orchestration macroservice atop the existing mass of production macroservices. The budget to get that one service into production might have been around $25m. Maybe double that to account for supporting changes that also needed to be made across various existing services. Maybe double it again for coordination overhead, reqs work, integrated testing.

In a similar environment, maybe it'd cost $1b-$10b to run an experiment comparing different strategies for microservice topologies (i.e. actually designing and building two different variants of the overall system and operating them both for 5 years, measuring enough organisational and technical metrics, then trying to see if we could learn anything...).

Anyone know of any results or data from something resembling a scientific method applied to this topic?

Post reply on HN