Reqflow
← All comparisons

Unique ID Generator (Snowflake) vs Instagram Feed

Unique ID Generator (Snowflake)

Unique ID Generator (Snowflake)

64-bit, roughly time-sortable IDs minted locally on each node: timestamp + worker id + per-ms sequence, no coordination on the hot path.

Components (4)

  • App Server
  • ID Generator A
  • ID Generator B
  • Coordination Service

Headline numbers

  • Lifespan from epoch~69 years
  • Max worker nodes1,024
  • Max IDs per node per second~4.096M
Instagram Feed

Instagram Feed

Fan-out on write vs read, ranking, CDN.

Components (10)

  • Mobile Client
  • CDN
  • API Gateway
  • Feed Service
  • Post Service
  • Kafka
  • Fan-out Worker
  • Redis
  • Postgres
  • S3

Headline numbers

  • Posts / sec (avg)~3,000/sec
  • Feed read QPS~58,000/sec
  • Fan-out writes / sec~600,000/sec

Key differences

Only in Unique ID Generator (Snowflake)
None.
In both
  • Service
Only in Instagram Feed
  • Mobile Client
  • CDN
  • API Gateway
  • Kafka
  • Redis
  • Postgres
  • S3

Flow shape

Unique ID Generator (Snowflake) flows
  • Generator boots and claims a worker id2 steps
  • Generate an ID (bit composition)2 steps
  • Two generators mint in the same millisecond4 steps
  • Sequence overflows within one millisecond3 steps
  • Clock moves backward (NTP correction)3 steps
Instagram Feed flows
  • Post a photo (fan-out on write)7 steps
  • Open feed (precomputed timeline)5 steps
  • Fan-out Worker is down7 steps
  • Timeline cache flushed (Redis restart)4 steps