SDSystem Design Studio
Search guide and handbook titles, headings, and text
Complete book · 4. Transactions and Consistency

Your handbook progress

0 of 31 sections complete.

Loading saved progress…

Guided learning paths

Interview preparation

Practice a repeatable design flow and the trade-offs most often explored in interviews.

12 sections · 3–5 hours · 0/12 complete

Continue path
  1. 1. Practical system-design workflow· Not complete
  2. 2. The 12-question system design loop· Not complete
  3. 3. 1. Requirements: FRs, NFRs, Constraints, and Assumptions· Not complete
  4. 4. 2B. Data Modeling, Indexing, and Partitioning· Not complete
  5. 5. 3. Concurrency· Not complete
  6. 6. 4. Transactions and Consistency· Not complete
  7. 7. 5. APIs, Contracts, and Idempotency· Not complete
  8. 8. 6. Messaging and Asynchronous Work· Not complete
  9. 9. 7. Failure Handling and Resilience· Not complete
  10. 10. 8. Scale, Capacity, Performance, and Caching· Not complete
  11. 11. 13. Master System Design Review Checklist· Not complete
  12. 12. Design review outcome template· Not complete

Architecture review

Review an architecture systematically from boundaries through operability and evolution.

17 sections · 5–7 hours · 0/17 complete

Continue path
  1. 1. 1. Requirements: FRs, NFRs, Constraints, and Assumptions· Not complete
  2. 2. 2. Boundaries, State, and Data· Not complete
  3. 3. 2A. Networking and Communication· Not complete
  4. 4. 2B. Data Modeling, Indexing, and Partitioning· Not complete
  5. 5. 2C. Time, Clocks, and Ordering· Not complete
  6. 6. 4. Transactions and Consistency· Not complete
  7. 7. 5. APIs, Contracts, and Idempotency· Not complete
  8. 8. 6. Messaging and Asynchronous Work· Not complete
  9. 9. 7. Failure Handling and Resilience· Not complete
  10. 10. 8. Scale, Capacity, Performance, and Caching· Not complete
  11. 11. 9. Security· Not complete
  12. 12. 10. Observability and Reliability· Not complete
  13. 13. 11. Deployment, Migration, and Evolution· Not complete
  14. 14. 12. Cost, Simplicity, and Operability· Not complete
  15. 15. 13. Master System Design Review Checklist· Not complete
  16. 16. Architecture Decision Record — short template· Not complete
  17. 17. Design review outcome template· Not complete

Agentic systems

Design agent and LLM systems with explicit contracts, failure boundaries, and review gates.

9 sections · 3–4 hours · 0/9 complete

Continue path
  1. 1. 1. Requirements: FRs, NFRs, Constraints, and Assumptions· Not complete
  2. 2. 5. APIs, Contracts, and Idempotency· Not complete
  3. 3. 6. Messaging and Asynchronous Work· Not complete
  4. 4. 7. Failure Handling and Resilience· Not complete
  5. 5. 9. Security· Not complete
  6. 6. 10. Observability and Reliability· Not complete
  7. 7. 15. LLM and Agentic Systems· Not complete
  8. 8. 16. Spec-Driven Development for Agentic Systems· Not complete
  9. 9. 17. Agent-System Design Review Checklist· Not complete

Complete handbook · Section 12 of 31

4. Transactions and Consistency

A transaction gives an atomic boundary for related changes inside a transactional resource. Isolation controls how concurrent transactions interact. Stronger isolation can simplify reasoning, but it can add aborts, retries, blocking, or overhead. Across independently managed services or data stores, one ACID transaction is often unavailable or undesirable, so consistency must be designed explicitly.

Evidence: S7, S16, S34

Practical rules

Keep one business invariant inside one transactional boundary when possible.

Know the database isolation level; do not assume “transaction” means serial execution.

If serialization conflicts are possible, the application must be able to retry the whole transaction safely.

For dual write such as DB + broker, use a reliable pattern such as transactional outbox instead of two unrelated writes.

For multi-service business workflows, decide whether temporary inconsistency is acceptable and how compensation works.

Evidence: S7, S15, S16

Checklist

  • Each business invariant has a clear transactional owner.

  • Transaction boundaries are visible in the design.

  • The required isolation level is chosen intentionally.

  • We know which anomalies are possible at the selected isolation level.

  • Serialization/deadlock retries are safe and bounded.

  • We do not perform an unprotected DB + message dual write.

  • If eventual consistency is used, the user-visible behavior is acceptable and documented.

  • If Saga/compensation is used, every compensable step has a defined compensating action.

  • We know what happens if compensation also fails.

  • Cross-service consistency is not stronger than the business actually needs.

  • If network partitions or multi-region operation matter, the availability-versus-consistency behavior is explicit.

Evidence: S7, S15, S16, S34

Advanced concepts to recognize

CAP, consensus, leader election, logical clocks, and distributed locks are important when the problem actually requires them. They are not default ingredients for normal application design.

Reliable DB + message publishing

If one business operation must update a database and publish a message, two unrelated writes can leave the system inconsistent. A transactional outbox stores the business update and an outbox record in one transaction; a separate publisher later sends the message. Consumers still need duplicate-safe processing.

Figure 3. Transactional outbox: atomic local write, asynchronous publication, idempotent consumer.

Diagram loads as you approach it.

Evidence: S12, S15

Practice after learning

Section learning lab

Build the idea, test your recall, and keep page-specific notes.

The canvas is horizontally scrollable on narrow screens. Select a node and use arrow keys or the move controls; dragging also works.

Diagram ready.

Loading saved work…