Skip to content

Data

Patterns for storing, splitting, reading and propagating data when a single database is no longer enough.

8 guides166 min in totalSystem patterns

The guides, in order

Read them top to bottom: each one builds on the ones before. The ones you've read carry a check.

  1. Transactional Outbox: Commit State and Events TogetherHow the transactional outbox pattern writes business state and its event in one database transaction, then relays events to a broker reliably.20 min readStart here
  2. CQRS: Separate Write and Read Models with ProjectionsHow CQRS splits a service into a write model that enforces rules and read models fed by projections, and how to handle the eventual consistency between them.21 min read
  3. Event Sourcing: Store What Happened, Derive What IsHow event sourcing makes an append-only event log the source of truth, and how to rebuild state, take snapshots and evolve event schemas safely.22 min read
  4. Sharding: Splitting Data Across Nodes by KeyHow to shard a database by key: choosing the shard key, handling hot tenants, and resharding live with a bucket map and a short write freeze.20 min read
  5. Consistent Hashing: Adding Cache Nodes Without a Miss StormPlace keys on a hash ring with virtual nodes so that adding or removing a server moves only about 1/N of the keys, instead of nearly all of them.19 min read
  6. Cache-Aside: Invalidation, Stampedes, TTLs and Stale ReadsHow cache-aside works against write-through, and how to stop stampedes, synchronized expiry and stale reads after writes in a production read path.22 min read
  7. Read Replicas: Scaling Reads Without Serving Stale WritesHow to scale reads with database replicas while keeping read-your-writes, evicting lagging replicas and failing over without losing commits.21 min read
  8. Change Data Capture: Stream Database Changes from the LogHow to stream every committed row change from a database's write-ahead log to search, caches and warehouses, with no dual writes and no lost updates.21 min read

About this group

What you'll find
Transactional outbox, CQRS, event sourcing, sharding, consistent hashing, cache-aside, read replicas and change data capture.
It's for you if…
your design has to scale reads or writes, or keep several systems in sync without losing data.
How each guide works
Each guide explains the problem, the solution and an analogy, with a diagram, pseudocode and code in TypeScript, Python and PHP. It also covers when to apply it, its trade-offs, how it fails and how to mitigate that, and when and how to bring it up in an interview.