Member-only story

Microservice Distributed Transactions 101: Guide to Choose the Best Strategy

🚀 Backend Scaling Playbook
8 min readJan 27, 2024

--

In monolithic systems, transactions typically rely on a single database, making it easier to maintain ACID properties. However, in microservices, each service often has its own database, complicating consistency across distributed systems. Challenges include maintaining atomicity, handling partial failures, and ensuring data consistency across services during multi-step operations.

For example, in an e-commerce platform, if the payment service deducts funds but the inventory service fails to update stock, inconsistencies occur, leading to customer dissatisfaction.

However, in a microservices environment where each service may have its own database, to complete a whole task (from order create to complete), multiple server needs to complete their respective transactions (deduce money in payment service, deduce quantity in inventory service, then complete order, sends to shipment in shipping service). If any of the service fails meanwhile (failed to deduce quantity in inventory-service) then the previous transactions (order creation, deduce money in payment service) are meaningless (cannot check/update quantity in inventory service but already deducted money from wallet in payment service, order created).

Scenario: Distributed Transaction in…

--

--

🚀 Backend Scaling Playbook
🚀 Backend Scaling Playbook

Written by 🚀 Backend Scaling Playbook

Scalable Distributed System, Backend Performance Optimization, Java Enthusiast. (mazumder.dip.auvi@gmail.com Or, +8801741240520)

Responses (4)

Write a response