Overview
Notes on researching CQRS.
What is CQRS
- Command Query Responsibility Segregation
- A pattern that separates responsibilities into Command and Query
- Command
- Performs data updates
- Designed to focus on tasks rather than data
- Expected to encapsulate the domain model of DDD
- Query
- Performs data retrieval
- Designed as an object optimized for each use case
- DTO
- Command
- A pattern that separates responsibilities into Command and Query
- Implementation Methods
- Event Sourcing Pattern
- In CQRS, events are commonly used to link commands and queries
- www.ibm.com - Command Query Responsibility Segregation (CQRS) pattern
- Discusses the gradual transition to CQRS
- Event Sourcing Pattern
- Benefits
- Can scale Read and Write independently
- Can choose data sources for Read and Write separately
- It is possible to keep the data source unified without separating
- If separating data sources, data synchronization is required either synchronously or asynchronously
- Simplifies the application-side model
- Drawbacks
- Increases system components, leading to higher costs
- Makes the overall network configuration more complex
Impressions
Deciding to implement this pattern feels quite challenging...
It seems there are many examples overseas, but I found that there are still few examples in Japan.
References
- microservices.io - Pattern: Command Query Responsibility Segregation (CQRS)
- learn.microsoft.com - CQRS Pattern
- learn.microsoft.com - Event Sourcing Pattern
- zenn.dev - Fully Understanding CQRS
- martinfowler.com - What Does "Event-Driven" Mean?
- martinfowler.com - CQRS
- docs.aws.amazon.com - CQRS Pattern
- logmi.jp - Chatwork's Tech Lead Discusses How to Use CQRS Effectively
- logmi.jp - "Doing CQRS" is Almost Synonymous with "Doing Event Sourcing": Design Philosophy Reflecting Reactive Systems and CQRS
- little-hands.hatenablog.com - Introduction to Practicing CQRS [Domain-Driven Design]
- hireoo.io - Creating a Microservice to Process Statistical Data Using the CQRS Pattern
- speakerdeck.com - Explaining CQRS/Event Sourcing in a Nutshell
- blog.j5ik2o.me - Why Does CQRS Become Event Sourcing?
- note.com - Can CQRS Be Achieved Without Event Sourcing?
- appmaster.io - Applying CQRS and Event Sourcing in Microservices
- www.ibm.com - Command Query Responsibility Segregation (CQRS) pattern
- www.eventstore.com - CQRS
- blog.risingstack.com - When Should You Use CQRS?
- logmi.jp - "Autonomy" Means Nothing if It Doesn't Function Independently: Considering the Advantages and Disadvantages of CQRS from Command and Query Requirements
- pages.awscloud.com - The Role and Implementation of CQRS & Event Sourcing in Modern Architecture