Design a fault-tolerant ID generation service for a distributed system

Quick Overview

A technical design question for product managers about building a service that issues unique identifiers across a large distributed system. It tests pinning down ordering, size and throughput requirements, comparing ID generation approaches, and handling failures such as clock drift and coordinator outages.

Design a fault-tolerant ID generation service for a distributed system

Company: Google

Role: Product Manager

Category: System Design

Difficulty: medium

Interview Round: Other

Design a system that generates unique identifiers for a large product built from many services, and that keeps up as traffic grows. Treat it as the technical design question a product manager is expected to reason through with engineers: settle what the IDs must guarantee, compare the main ways to generate them, recommend one, and explain how it behaves when machines, clocks or the network fail. ```hint Uniqueness is not the only requirement Before choosing where IDs come from, find out what else callers need from them: sorting by creation time, a fixed size such as 64 bits, or safety when shown publicly. Each of those answers rules some designs in and others out. ``` ### Clarifying Questions - What do the IDs identify (database records, user-visible objects such as orders or posts, log events), and will users ever see or share them in URLs? - Must IDs sort by creation time, strictly increase, or merely be distinct? - Is there a size or format limit, such as fitting in a 64-bit integer column? - What peak rate of new IDs and how many data centers should the design support, and must generation continue when a data center is cut off from the others? ### What a Strong Answer Covers - Requirements fixed before design: the uniqueness guarantee, ordering, size, throughput, latency and availability. - A comparison of the main generation approaches (database counters, random identifiers, block allocation from a central service, and time-based composite IDs) on coordination cost, ordering, size and failure behavior. - A justified recommendation with its layout or allocation scheme spelled out and its capacity and lifetime checked. - Failure handling for clocks moving backwards, two machines claiming the same identity, coordinator outages and restarts. - Consequences for the product and its users, such as IDs revealing business volume, 64-bit values in client code, and how duplicates would be detected. ### Follow-up Questions - After a time sync, one server's clock jumps back two seconds. What does your generator do, and what does the caller see? - The IDs appear in public URLs, and an outsider estimates your daily order volume by comparing two of them. How would you change the design? - The product expands to a second region that must keep creating records while disconnected from the first. What changes, if anything?

Overview: A technical design question for product managers about building a service that issues unique identifiers across a large distributed system. It tests pinning down ordering, size and throughput requirements, comparing ID generation approaches, and handling failures such as clock drift and coordinator outages.

Google logo
Google
Aug 14, 2025
mediumProduct ManagerOtherSystem Design
0
0

Design a system that generates unique identifiers for a large product built from many services, and that keeps up as traffic grows. Treat it as the technical design question a product manager is expected to reason through with engineers: settle what the IDs must guarantee, compare the main ways to generate them, recommend one, and explain how it behaves when machines, clocks or the network fail.

Clarifying Questions Guidance

  • What do the IDs identify (database records, user-visible objects such as orders or posts, log events), and will users ever see or share them in URLs?
  • Must IDs sort by creation time, strictly increase, or merely be distinct?
  • Is there a size or format limit, such as fitting in a 64-bit integer column?
  • What peak rate of new IDs and how many data centers should the design support, and must generation continue when a data center is cut off from the others?

What a Strong Answer Covers Guidance

  • Requirements fixed before design: the uniqueness guarantee, ordering, size, throughput, latency and availability.
  • A comparison of the main generation approaches (database counters, random identifiers, block allocation from a central service, and time-based composite IDs) on coordination cost, ordering, size and failure behavior.
  • A justified recommendation with its layout or allocation scheme spelled out and its capacity and lifetime checked.
  • Failure handling for clocks moving backwards, two machines claiming the same identity, coordinator outages and restarts.
  • Consequences for the product and its users, such as IDs revealing business volume, 64-bit values in client code, and how duplicates would be detected.

Follow-up Questions Guidance

  • After a time sync, one server's clock jumps back two seconds. What does your generator do, and what does the caller see?
  • The IDs appear in public URLs, and an outsider estimates your daily order volume by comparing two of them. How would you change the design?
  • The product expands to a second region that must keep creating records while disconnected from the first. What changes, if anything?