4 ms·
Do you have a recommended way of handling transaction boundaries that span multiple services. Everyone always likes to outline how happy path works and when it
by qaq 8y ago
Do you have a recommended way of handling transaction boundaries that span multiple services. Everyone always likes to outline how happy path works and when it comes to real world it basically comes down to well now you have eventually consistent distributed system that there is no general valid way to unroll a change to multiple services if one of the calls fails.
- dudul 8y agohttps://microservices.io/patterns/data/saga.html https://microservices.io/patterns/data/saga.html
- qaq 8y ago"In order to be reliable, a service must atomically update its database and publish a message/event." so in other words to some transaction log so we just reinvented a distributed transactional database system with crapload of custom programming overhead. Whatever solution is described they all pretty much boil down to an equivalent of distributed eventually consistent database or distributed acid database but with a large number of database functionality pushed into the application.
- pojzon 8y agoSo distributed acid db... Noone till now (from what i have seen) came up with a better solution than guys 50 years ago..
- dustindiamond 8y agoWell, we’ve gotten this far...
- analyst74 8y agoIf several databases/services are so tied together that they need to be updated/rolled back at the same time, then they belong to the same service/database. There will be times when you trade data consistency for performance/scalability, i.e. in a scenario where you are breaking user actions away from the main user service, if a user is deleted but deleting from user actions failed, you don't roll back the user delete. Either just let the invalid data sit in user actions database, or do separate clean-ups periodically.