scalable architecture for the cloud l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
CQRS and Windows Azure PowerPoint Presentation
Download Presentation
CQRS and Windows Azure

Loading in 2 Seconds...

play fullscreen
1 / 27

CQRS and Windows Azure - PowerPoint PPT Presentation


  • 91 Views
  • Uploaded on

Scalable Architecture for the Cloud. CQRS and Windows Azure. What????. Command Query Responsibility Segregation What is it? What kinds of apps is it for? What are the moving parts? What does it buy me? How do I do this on Azure?. What is it?. An architectural pattern

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'CQRS and Windows Azure' - aldis


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide2
What????
  • Command Query Responsibility Segregation
    • What is it?
    • What kinds of apps is it for?
    • What are the moving parts?
    • What does it buy me?
    • How do I do this on Azure?
what is it
What is it?
  • An architectural pattern
  • Embracing modern requirements
    • Self service
    • High scalability
    • Asynchronous processing
applicability
Applicability
  • Multiple simultaneous users
  • Untrained users
  • We’ll be talking about the web
applicability5
Applicability
  • Usage patterns
    • More reads than writes
    • No really, more reads than writes
    • Lots, lots, lots more
applicability6
Applicability
  • Asynchronous Processing
    • “Thank you, you will receive a confirmation email shortly.”
3 tier architecture
3-Tier Architecture

DB

WRITE

READ

Domain

UI

is it really symmetric
Is it really symmetric?
  • Reads
    • Fast
    • Synchronous
    • Idempotent
    • Stale
  • Writes
    • Slow
    • Asynchronous
    • Stateful
    • Current
sidebar
Sidebar
  • Command Query Separation
    • Methods should either:
      • Query State and return a value
      • Or Execute behavior and return nothing
  • Bertrand Meyer
cqrs architecture11
CQRS Architecture

READ DB

WRITE DB

WRITE

READ

READ MODEL

WRITE MODEL

Q

UI

read model store
Read Model / Store
  • Optimized for Reading
    • Denormalized out the wazoo!
    • Matches UI model requirements
    • No logic – DTO
    • One “table” per screen
    • SELECT * FROM TABLE WHERE …
    • No joins
  • It’s a cache, not a database!
write model store
Write Model / Store
  • Accepts Commands
  • Executes Business Rules
  • Generates Business Events
write read side sync
Write / Read Side Sync
  • Processes Domain Events
  • Updates tables in read store
what s a command
What’s a Command?
  • A message
  • Named in the imperative
    • AddNewUser
    • PublishDocument
    • LaunchMissiles
  • Task Oriented
command processing
Command Processing
  • UI Validates before sending
  • UI Sends command
  • Write model re-validates
  • Write model processes business rules
  • Write model generates events
  • Assume commands will succeed most of the time
what s an event
What’s an event?
  • A message
  • Named in the past tense
    • UserAdded
    • NewDocumentPublished
    • WentBoom
  • Express Changes in the domain over time
  • Save the event stream for reprocessing
event processing
Event Processing
  • Receive events as they come out
  • Update read stores
how is this scalable
How is this scalable?
  • Web Farms
  • Event Processors
  • Read Stores
  • Harder to scale the write side
    • But we have lots more reads anyway
other advantages
Other Advantages
  • External System Integration
    • Events write to external system
    • Commands when external system wants you to do something
  • You know it works, you’re using it!
mapping to azure
Mapping to Azure
  • Queues
  • Table Store
    • Event Store
    • Read Stores
  • Worker role
    • Command processors
    • Event Processors
  • Web role
    • Front end
what is event sourcing
What is event sourcing?
  • Model Persistence
    • ORM
  • We’re generating events anyway
  • Events record changes to the domain over time
  • So we know every state change that’s happened anyway
event sourcing
Event Sourcing
  • Load domain entities by “playing back” domain events
  • No need for ORM
  • Use snapshots for efficiency
resources
Resources
  • UdiDahan
    • http://www.udidahan.com
  • Greg Young
    • http://codebetter.com/blogs/gregyoung/
    • http://cqrs.wordpress.com/
  • Mark Nijhof
    • http://cre8ivethought.com/blog/index
    • http://www.agilification.com/post/CQRS-Series-from-Mark-Nijhof.aspx