CQRS Projection Lag Expansion
In a CQRS architecture, the read-side projection processor falls behind the event stream. The query model serves stale state while the command model has already accepted and committed new writes. As projection lag grows, reads become increasingly inconsistent with writes: violating the eventual consistency promise and exposing users to stale, contradictory, or missing data.
Event store (PostgreSQL/EventStoreDB) + projection processor + read model (PostgreSQL read replica or denormalized store)
Degradation Replay
Nominal: Projection Synchronized
Projection processor consuming events as fast as they are produced
Critical: 1,100 exceeds critical threshold of 200 events/s
- ·Projection lag < 50 events: near-real-time read model
- ·Query-side data consistent with command-side within 500ms
- ·No failed projection handler events in dead-letter stream
- ·Projection processor offset within 1-2 WAL segments or Kafka offsets of writer
- ·Read model reflects all committed commands
- !Reads consistent with writes within acceptable eventual-consistency window
Operational simulation model only, not a production forecast. Degradation stages are derived from structured operational knowledge, not measured telemetry. Do not use for capacity planning or incident response.
Run With Your Parameters
Adjust the parameters below to see how metric values shift across degradation stages. Formulas are deterministic: same inputs always produce the same output.
Simulation Parameters
Event sourcing projection processing lag behind head
Computed Degradation Stages
Projection processor consuming events as fast as they are produced
Event apply rate drops below event production rate: lag accumulating
A failing event handler blocks the projection stream: lag rate accelerating
Projection lag so large that incremental catch-up is infeasible: full rebuild needed
Projection rebuild initiated; processor replaying events from last known-good checkpoint
Threshold Events
Projection lag at 5.0s exceeds acceptable staleness SLA of 2.0s. Read-side views are serving stale data.
Projection lag at 8.1s exceeds acceptable staleness SLA of 2.0s. Read-side views are serving stale data.
Interpretation
CQRS projection lag of 5s creates 13.8s staleness at 2,000 write RPS: 6.9× SLA.
Projection processor cannot keep pace with write rate: read side falls behind
Scale projection consumers horizontally. Add projection position metrics to alert before SLA breach. For strongly-consistent reads, route to command side (primary) and accept latency cost.
Parameterized simulation: not a production forecast. Values derived from deterministic formulas applied to your parameters. Do not use for capacity planning or operational decisions without validation.
Propagation Model
Projection lag accumulates at (event_rate - projection_apply_rate) events/sec; read model falls behind committed event log
Stabilizes: Lag stabilizes when projection apply rate recovers above event rate
Read queries return state that contradicts recent command results; users who just wrote data see pre-write state on next read
Stabilizes: Stale read window closes as projection catches up to command model LSN
A failed event handler blocks the projection processor; all subsequent events queue behind the failing event until handler is fixed or event is skipped
Stabilizes: Unblocked only by fixing the handler or explicitly skipping the failing event
Recovery Patterns
Fix handler and resume from blocked offset
15-120 minutes depending on backlog accumulated during block- ·Handler fix requires code deployment: adds deployment risk during incident
- ·If skipping the bad event, manual reconciliation needed for affected entities
- !Skipped events leave permanent gaps in read model: audit trail incomplete
Full projection rebuild from event store
30 minutes to 6 hours depending on event store depth- ·During rebuild, read model unavailable or frozen: user-facing features degraded
- ·Event store under significant read load during replay: monitor primary DB
- !If event store does not retain all events, rebuild cannot recover to full state
Operational Summary
CQRS projection lag occurs when the read-side projection processor cannot keep up with the event stream. The critical failure mode is a blocking event handler: a single failing event blocks all subsequent events, causing the read model to freeze while the command model continues accepting writes. The divergence grows with every write until the handler is fixed or the event is skipped. Prevention requires handler circuit breakers, explicit event schema versioning, and projection lag monitoring with rate-of-change alerting.