Design a Globally Unique Time-Ordered ID Generator for Posts

Last updated: November 29, 2026

Quick Overview

Design a service that generates unique 64-bit IDs for posts, comments, and messages across many data centers, with IDs roughly sortable by creation time and no single point of coordination.

Meta
System Design
Software Engineer
Meta
November 29, 2026
Software Engineer
Technical Screen
System Design
Easy

0

0

0 solved


Design a service that generates unique 64-bit IDs for posts, comments, and messages across many data centers, with IDs roughly sortable by creation time and no single point of coordination.

This shorter design question appears in Meta phone screens or as a warm-up in a system design round. The interviewer checks bit-layout reasoning, clock issues, and whether you know when coordination is avoidable.

What the Interviewer Expects
  • Propose a bit layout: timestamp, machine or shard ID, sequence
  • Compute capacity: years of range and IDs per millisecond per node
  • Handle clock moving backwards
  • Explain how machine IDs are assigned without collisions
  • Compare with UUIDs and DB auto-increment
Key Topics to Cover
Snowflake IDs
Clock skew
Bit packing
Coordination-free design
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • What if you need IDs that also encode the shard where the object lives?
  • How would you guarantee strictly increasing IDs per user?
  • What leaks if IDs are exposed publicly, and does it matter?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: next_id() returns a unique 64-bit integer; IDs from the same node increase; across nodes they are roughly ordered by time. Non-functional: over 100K IDs/s per node, sub-milliseco...

High-Level Design

Each application host (or a small sidecar) generates IDs locally:

bitsfield
1sign, always 0
41ms since custom epoch
10worker ID (region + machine)
12per-ms ...

Submit Your Answer
Markdown supported