AI & Technical question
You're the CTO of a company. Design a program that provides unique IDs upon requests from a client. This program will be used by Facebook and Google and needs to scale.
- AI & Technical
- Hard
Practice this question out loud. An AI interviewer asks it, follows up like a real interviewer would, and scores your answer. Type or speak.
Start a mock interview on this question · Mock interview from a job description
What this question tests
Distributed systems design for a unique ID generator at massive scale, a classic system design problem.
How to approach it
- Clarify requirements: IDs must be unique, roughly sortable by time for indexing, and generated at very high throughput with low latency.
- Rule out a single centralized counter, since it becomes a bottleneck and single point of failure at this scale.
- Propose a Snowflake-style approach: each ID combines a timestamp, a worker ID, and a per-machine sequence number, generated independently per node.
- Explain why this scales: no cross-node communication is needed per request, so throughput scales linearly with node count.
- Address clock skew risk: handle cases where a node's clock moves backward, which can cause collisions if unhandled.
- Note operational needs: worker ID assignment and monitoring for clock drift across the fleet.
What a strong answer includes
- Correctly rules out a centralized counter as unscalable and names the real distributed pattern used at this scale.
- Explains the mechanism precisely, timestamp plus worker ID plus sequence, rather than vaguely saying "generate random IDs."
- Names clock skew as a specific, real failure mode and proposes handling it, showing depth beyond the happy path.
- Addresses worker ID assignment as an operational detail, not just the ID format.
Common mistakes
- Proposing a single centralized ID generator, which cannot scale to this throughput.
- Ignoring clock skew and node coordination edge cases.
- Not addressing how worker IDs get assigned without collision.
Likely follow-up questions
- How would you handle a node's clock moving backward?
- How would you assign and manage worker IDs across a large fleet?
- What happens if two clients request an ID for the same logical event simultaneously?
More ai & technical questions
- Design a simple load balancer for Google.com. What data structures would you use?Google · AI & Technical · Hard
- How does TinyURL work?Google · AI & Technical · Easy
- How would you explain cloud computing to your grandmother?Google · AI & Technical · Easy
- What happens when you enter a URL in your browser?Google · AI & Technical · Easy
- You’re part of the Google Search web spam team. How would you detect duplicate websites?Google · AI & Technical · Hard
- Explain the data pipeline for the last AI project you worked on. What were the top challenges in getting data, and how did you resolve them?Google · AI & Technical · Hard
More questions from Google
Learn the skill behind it
Chapters of the AI PM course that teach what this question tests.
- Chapter 1: Foundations: the model and the decisions it forces on you
- Chapter 8: Evals: define good and make the number defensible
- Chapter 6: Agents and agentic architecture