Skip to content

Distributed Counter — Notes#

Functional#

  • Increment by key (likes, views, votes).
  • Read current count.
  • Optional decrement.

Non-functional#

  • p99 increment < 10 ms.
  • Reads cached for short windows.
  • Approximate is acceptable for non-financial use.

Trade-offs#

  • Sharded micro-counters scale writes; sum-on-read is the cost.
  • Approximate with HLL/CMS for billion-scale.
  • Exact requires ledger + reconciliation.

Refs#

  • Facebook "TAO" counters.
  • Discord counters posts.
  • ByteByteGo "Design distributed counter".