19 - The Event Sourcing, Materialized View and CQRS Patterns

19 - The Event Sourcing, Materialized View and CQRS Patterns

2020-12-23

These three cloud design patterns — Event Sourcing, Materialized View, and CQRS — are frequently used together in event-driven systems and are especially well-suited to cloud environments like Azure. In this episode, Chris and Steph explore each pattern individually and explain how they complement each other.

Event Sourcing

Instead of storing only the current state of an entity, Event Sourcing records every event that led to that state as an immutable, append-only log. Think of it as a complete audit trail of decisions:

  • A customer adds an item to their basket → event recorded
  • They remove an item → event recorded
  • They complete the purchase → event recorded

This history enables rich analytics, targeted personalisation, and the ability to reconstruct state at any point in time. Azure Cosmos DB’s change feed is a natural fit for implementing this pattern at scale.

Materialized View

Raw event logs are powerful, but querying them directly can be expensive. The Materialized View pattern pre-computes a denormalised, query-ready view of data from one or more event streams. This is particularly valuable when the source data structure doesn’t match the shape required by consumers — a common challenge in microservices architectures.

CQRS (Command Query Responsibility Segregation)

CQRS formally separates the write model (commands that change state) from the read model (queries that return data). This separation allows each side to be independently scaled and optimised. Event Sourcing and Materialized Views map naturally onto the CQRS model: events flow from the command side, and materialized views serve the query side.

When to Use These Patterns

These patterns add architectural complexity and are best suited to domains where audit history, temporal queries, or significant read/write asymmetry are genuine requirements — not as a default choice for every application.

Related Content

18 - Tales from the Real World - Defying Gravity.. The magic behind Flight Simulator 2020

18 - Tales from the Real World - Defying Gravity.. The magic behind Flight Simulator 2020

2020-12-18

What's actually powering Microsoft Flight Simulator 2020 — and what can cloud architects learn from it? Chris Reddington takes to the virtual skies over Queensland with former colleague Cam Adams, flying a Cessna 172 from Archerfield aerodrome while discussing the real Azure services behind one of the most technically ambitious games ever made. From CDN-based asset distribution and event-driven live weather to PlayFab game backends and DDoS protection — this is cloud architecture on the fly.

17 - The Throttling, Retry and Circuit Breaker Patterns

17 - The Throttling, Retry and Circuit Breaker Patterns

2020-12-04

How do you protect your infrastructure from traffic spikes, safeguard multi-tenant workloads from noisy neighbours, and handle transient failures gracefully? Chris and John Downs walk through three essential cloud resilience patterns: Throttling (protecting services from excess load via rate limiting and HTTP 429), Retry (handling transient faults with exponential backoff), and Circuit Breaker (preventing cascade failures). Part of the "Architecting for the Cloud, One Pattern at a Time" series — essential viewing for any developer building on Azure.

16 - The Backends for Frontends and Strangler Pattern with Peter Piper

16 - The Backends for Frontends and Strangler Pattern with Peter Piper

2020-11-22

Managing APIs across web, mobile, and multiple consumer types creates tight coupling that slows modernisation and makes versioning painful. In this episode, Chris Reddington is joined by Peter Piper to explore the Backend for Frontends (BFF) pattern — creating dedicated backends tailored to each consumer — alongside the Strangler Fig pattern for incrementally migrating legacy monoliths without disrupting existing clients. The Façade pattern also features as a key decoupling mechanism for smooth API migrations. Part of the "Architecting for the Cloud, One Pattern at a Time" series.