Design a globally-distributed edge counter

DesignHard45 min

Your task

Design a globally-distributed counter/limiter that runs at the edge (200+ locations) for 'free article views per month' on a publisher's paywall, each user gets 5 free articles, enforced at the nearest PoP for low latency, but the count must be approximately consistent globally so a user can't get 200 free articles by hopping PoPs. Reads/writes happen at the edge; the origin is far. Describe the state model, the consistency you choose and why, how you reconcile concurrent increments across PoPs, and how you bound the over-count.

It covers

  • State
  • Consistency
  • Geo replication