News for hackers. Stuff that matters.
Re: by banq on Wednesday August 30, 2023 @06:28PM (#37329981)
The Saga is Antipattern https://sergiy-yevtushenko.medium.com/the-saga-is-antipatter...

Microservices distributed transactions are an anti pattern

Re: by hakunin on Wednesday August 30, 2023 @06:39PM (#37330084)
In most cases microservices are an anti-pattern, because they are trying to solve problems that can be solved without incurring their complexity and sacrifices.

However, I remember Sagas originally applied to dealing with multiple 3rd party API, the example was "book flight, hotel, rental car". If you're dealing with necessarily separate systems, then there's probably a place for sagas.

Re: by nextaccountic on Wednesday August 30, 2023 @07:40PM (#37330566)
The author talks about this too

> As soon as we start doing separation of domains according to data governance, we may quickly realize that in the vast majority of cases, microservices look a lot like traditional monoliths and the domain they should handle is big. Or realize that traditional monoliths are, in fact, microservices. This happens because most organizations have only a very limited number of truly independent domains. Most often — one.

Re: by paulddraper on Wednesday August 30, 2023 @07:09PM (#37330316)
How so?

If I want to pay for and book a flight and hotel.....

You have to implement distributed transactions. (Either that or YOLO.)

Re: by numbsafari on Wednesday August 30, 2023 @11:35PM (#37332164)
This is not true, and not YOLO, either.

You have four separate businesses (at least): a bank, an airline, a hotel, and booking agency.

There's no way that some random booking agency is getting an XA transaction (or other distributed transaction protocol) implemented between the disparate systems it is orchestrating.

It has to maintain conversational state with each of those systems in the domain/model of the exposed APIs of each in order to coordinate a resolution. Even if you could do that with an distributed transaction coordinated between those disparate entities, the possible failure states of each are such that you likely wouldn't want to. For example: go ahead and book the flight and pay for it if you can, but don't rollback the whole thing if the hotel ends up needing to decline for some reason.

These business models exist today as real world systems, and they aren't implemented using distributed transactions.

Re: by paulddraper on Wednesday August 30, 2023 @11:39PM (#37332183)
Those are in the abstract and literal sense, distributed transactions.
Re: by yathaid on Thursday August 31, 2023 @02:10AM (#37333108)
Tell me you are implementing distributed transactions without telling me you are using distributed transactions! :)
Re: by silon42 on Thursday August 31, 2023 @02:42AM (#37333327)
This what basically what a Saga is... a process that uses custom protocols to resolve the state of multiple entities to a consistent valid state.

Sure, avoid Sagas when possible (use a DB transaction if you can merge microservices), but when you aren't setting system boundaries (aka your world isn't a single system supporting XA everwhere), the Saga is a completely valid and necessary mechanism.

Re: by ryanjshaw on Thursday August 31, 2023 @02:00AM (#37333018)
I didn't understand anything written in that post. Saga was mentioned 5 times: once in the title, once in a tag, and 3 times in the 1st paragraph. I would have benefited from an example, as everything was too abstract for me to follow.