Design distributed transactions protocol

Quick Overview

This question evaluates a candidate's understanding of distributed transactions, coordination protocols, fault tolerance, consistency, and reliability across microservices and databases.

Design distributed transactions protocol

Company: Google

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Technical Screen

Design a distributed transactions protocol to coordinate updates across multiple services or databases. Compare two-phase commit, three-phase commit, and Saga patterns; specify message flows, failure handling, idempotency, timeouts, and exactly-once versus at-least-once guarantees.

Overview: This question evaluates a candidate's understanding of distributed transactions, coordination protocols, fault tolerance, consistency, and reliability across microservices and databases.

|Home/System Design/Google
Google logo
Google
Sep 6, 2025
hardSoftware EngineerTechnical ScreenSystem Design
13
0

System Design: Distributed Transactions Across Multiple Services

Context

You must design a distributed transactions protocol to coordinate updates across multiple services or databases in a microservices environment. The network is unreliable (messages can be delayed, duplicated, or lost), services can crash and recover, and latency and availability matter.

Assume services communicate over RPC and/or a message bus. Some services may support a "prepare/commit" primitive; others may not.

Task

  1. Propose a protocol to coordinate multi-service updates.
  2. Compare and contrast the following approaches:
    • Two-Phase Commit (2PC)
    • Three-Phase Commit (3PC)
    • Saga (orchestration and/or choreography)
  3. For each approach, specify:
    • Message flow (step-by-step)
    • Failure handling (coordinator crash, participant crash, message loss/duplication, partition)
    • Idempotency mechanisms
    • Timeouts and retries
    • Delivery guarantees (exactly-once vs at-least-once) and what you can realistically achieve
  4. Conclude with a recommendation for when to use each approach and how to implement it safely.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...