← All comparisons

Google Docs (Realtime Collab) vs URL Shortener

Google Docs (Realtime Collab)

Google Docs (Realtime Collab)

Operational Transforms (or CRDTs) merge concurrent edits from many clients into one consistent document.

Components (7)

  • Browser Client
  • WebSocket Gateway
  • Document Service
  • OT Server
  • Presence Service
  • Snapshot Store
  • Op Log

Headline numbers

  • Op QPS~25M/sec aggregate
  • WebSocket connections~100M peak
  • Op log writes / sec~25M/sec
URL Shortener

URL Shortener

Hashing, key generation, read-heavy caching.

Components (6)

  • Client
  • API Gateway
  • Write Service
  • Read Service
  • Redis
  • Postgres

Headline numbers

  • Write QPS (avg)~1,200/sec
  • Read QPS (avg)~120,000/sec
  • Storage per year~5 TB

Key differences

Only in Google Docs (Realtime Collab)
  • Op Log
In both
  • Client
  • Api Gateway
  • Service
  • Database
Only in URL Shortener
  • Redis

Flow shape

Google Docs (Realtime Collab) flows
  • Open a document4 steps
  • Two users type at the same character position5 steps
  • OT server box crashes mid-edit5 steps
URL Shortener flows
  • Shorten a URL3 steps
  • Resolve short URL (cache hit)3 steps
  • Resolve short URL (cache miss)4 steps
  • Redis is down4 steps