codefest 2014. christopher bennage — cqrs journey: scalable, available, and maintainable systems
Post on 14-May-2015
982 Views
Preview:
TRANSCRIPT
Exploring CQRS and Event SourcingA journey into high scalability, availability, and maintainability with AzureChristopher Bennagepatterns & practicesmicrosoft.com/practices
•Scale with predictable cost•Scale at unpredictable times•Be continuously available
New RequirementsArchitecting for Today
CommandQuery Responsibility Segregation
What is CQRS?Separating Reads from Writes
An architectural pattern that separates Commands (that change state) from Queries (that only read state).
N-Tier20th Century Architecture
Domain Logic
Presentation
Persistence
Commands Queries
Applying CQRSSeparate Data Stores
Presentation
Validation
Commands
Domain Logic
Data persistence
Queries (generate DTOs)
What is Event Sourcing?An Alternate Way to Represent the Data
Cart Created
Item 1 Added
Item 2 Added
Item 1 Removed
Shipping Information
Added
Relational Model
Event Stream
CQRS / ES
Presentation
Validation
Commands
Domain Logic
Data persistence
Read thin-layer
<<projection>>
Based on Rob Ashton’s codeofrob.com/entries/cqrs-is-too-complicated.html
• Data is sent from Write model to Read model
• Possibility of stale data• Does it have a business impact?
Eventual ConsistencyThe Trade-Off
“For the things we have to learn before we can do them, we learn by doing them.”
~Aristotle
• Is there a natural seam between reads and writes? •Are the business rules ever changing? • Is scalability one of the challenges? •Are benefits that CQRS brings clear?
When to Use CQRS?
• Throw away your assumptions•Only distribute when necessary• CQRS is not a top-level architecture• Choose the right approach for each part of the problem • In a message-based system, tracing is very important• Test for performance early and frequently• Existing libraries, framework, and infrastructures can help
Some Lessons Learned
Scalability results from Independence
Insights After CQRSUnits of Scale
•cqrsjourney.github.com•aka.ms/cqrs•aka.ms/cqrspdf
Resourcesmicrosoft.com/practices
@bennagedev.bennage.com
Русская версия в апреле 2014!
Вопросы?
Christopher Bennagepatterns & practicesMicrosoft
christopher.bennage@microsoft.com
top related