← Back to microservices patterns mapdata
Microservices Pattern
CQRS
Separate write models from read models so each can optimize for its own workload.
Detailed Description
CQRS is useful when reads and writes have very different shapes or scale needs.
It often pairs with events so read models can be updated asynchronously.
Visual Diagram
CQRS inside a service
WRITE SIDE (Commands)
POST /orders → CommandHandler
→ validates business rules
→ updates Write DB (normalized)
→ emits OrderPlaced event
READ SIDE (Queries)
GET /orders → QueryHandler
→ Read DB (denormalized, fast)
→ populated from eventsTradeoffs
Pros
Fast reads, independent scaling, clear write intent
Cons
More moving parts and eventual consistency
Examples: Event-sourced systems, denormalized read stores
Comments
Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.
Loading comments...
On this page
0 sections