Home

/

The Production-Ready Playbook

/

Altitude 3: Data & Persistence

Altitude 3: Data & Persistence

Appendix A
Appendix
3
min read

Altitude 3 — Data & Persistence

The database layer the catalogues under-serve. Start dense, escalate only when forced. The combo slot is the heaviest carrying cost in the book.

PatternWhat it solvesThe shapeSkip-if
Multitenancy (shared schema + RLS)Isolate tenants in one databaseOne DB, a tenant_id column, Row-Level Security enforcing the boundaryA single-tenant product: build none of it
Event Sourcing + CQRS + Materialized ViewAudit, replay and read-scale without locking the write modelEvents as the write log, materialized views as the read model, CQRS the umbrellaMost CRUD apps: the heaviest skip-if in the book
Optimistic ConcurrencyDetect conflicting writes without lockingA version or rowversion checked on update; the loser retriesSingle-writer data
Evolutionary Schema MigrationsChange the schema safely and reproduciblyVersioned, forward-only scripts (DbUp-style, not EF migrations)Never, but keep it lightweight
Sharding / PartitioningScale data past one boxData split across stores or partitions by a keyNowhere near a single DB's limits: a classic tax
Cache-AsideCut read latency and DB loadLoad on miss, populate the cache, serve from it next timeWrites dominate, or staleness can't be tolerated and you can't invalidate cleanly
Soft Delete / TemporalKeep recoverable data and a change historyA flag or system-versioned rows; reads exclude deletedNo recovery or audit value (and mind the per-read query cost)

Honorable mentions: lightweight Unit of Work (transaction boundary across gateways), Read Replicas, Connection Pooling.

Altitude 4 — Messaging & Scale

Put a broker between the parts that produce work and the parts that handle it. A queue absorbs spikes, lets you add workers when volume grows, and parks failed messages instead of losing them. Broker-neutral: GCP Pub/Sub (AWS SQS+SNS, Azure Service Bus).

PatternWhat it solvesThe shapeSkip-if
Queue-Based Load LevellingAbsorb a spiky producerA queue between producer and a steady-rate consumerSynchronous, low-volume work
Competing ConsumersScale processing horizontallyMany workers pulling from one queueOrdering matters more than throughput
Publish/SubscribeFan one event out to many consumersA topic; independent subscribers add themselves without touching the producerExactly one consumer, forever
OutboxStop lost or double events between DB and brokerThe event written in the same DB transaction, published after commitNo cross-system consistency need
Backpressure / Dead-Letter QueueNever silently drop failed workSignal upstream to slow; park unprocessable messages for inspectionIn-memory, single-process work
Saga / Process ManagerKeep consistency across services with no 2PCA multi-step distributed transaction with compensating actionsYou don't yet have a distributed transaction: a heavy skip-if
Claim-CheckKeep messages small and fastThe large payload stored externally; only a token rides the busPayloads are already small

Honorable mentions: Idempotent Consumer (see Altitude 5), Event-Carried State Transfer, Priority Queue.

the-pareto-stack-cloud-design-patterns-for-small-teams
the-ladder-of-altitudes
how-to-read-this
object-level-the-patterns-that-earn-their-keep
decorator
state
component-level-structuring-one-service
ports-and-adapters-hexagonal
mediator-the-commandquery-split
data-persistence
optimistic-concurrency
messaging-scale
outbox
resilience-staying-up-when-dependencies-dont
rate-limiting-throttling
timeout-fallback
the-composed-pipeline
observability-diagnostics-seeing-inside-production
metrics-the-four-golden-signals
externalised-configuration
hosting-cloud-agnostic-by-default
sidecar-ambassador
orchestrator-agnostic-deploy
a-reference-service
the-relay-outbox-to-queue
the-payment-saga-charge-pay-out-compensate
the-over-engineering-tax
conclusion-production-ready-deliberately
the-pattern-quick-reference-card
altitude-3-data-persistence
altitude-5-resilience
the-skip-list
full-event-sourcing-for-crud
robert-c-martin-uncle-bob-the-house-authority-for-structure
altitude-2-component
altitude-4-messaging-scale
altitude-6-observability-diagnostics

Download the full PDF for free?

Free download — no account required

Get the PDF
Get the PDF
Related Chapters
Free Download
Get the full PDF
All pages, including all code examples, diagrams, and the appendix reference card.
No spam. Unsubscribe at any time.
Your email won't be shared.
Oops! There's a problem with your request. We're working on fixing it. Please try again later.