0% found this document useful (0 votes)
23 views12 pages

CQRS Architecture Implementation On AWS

CQRS (Command Query Responsibility Segregation) is a design pattern that separates write and read operations, typically implemented with distinct APIs and databases. It is beneficial when read and write workloads have different scaling and consistency requirements, but may not be suitable for projects needing immediate consistency or where complexity is unjustified. The document discusses various database options for implementing CQRS on AWS, including DynamoDB, Aurora/RDS, and OpenSearch, highlighting their respective advantages and disadvantages.

Uploaded by

Habib Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views12 pages

CQRS Architecture Implementation On AWS

CQRS (Command Query Responsibility Segregation) is a design pattern that separates write and read operations, typically implemented with distinct APIs and databases. It is beneficial when read and write workloads have different scaling and consistency requirements, but may not be suitable for projects needing immediate consistency or where complexity is unjustified. The document discusses various database options for implementing CQRS on AWS, including DynamoDB, Aurora/RDS, and OpenSearch, highlighting their respective advantages and disadvantages.

Uploaded by

Habib Malik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

CQRS Architecture

Implementation on AWS
What is CQRS
- CQRS stands for Command Query Responsibility Segregation

- In principle this design pattern separates Write (Command) operations


and Read (Query) operations

- In the context of .NET, we will create two separate APIs (Write API and
Read API), each with different DbContext

- Data between Write API and Read API can be replicated synchronously or
asynchronously, both has its own advantages and disadvantages.

- Due to the Eventual Consistency nature of the read database, this


pattern is usually used in conjunction with Event Sourcing pattern.
Why use CQRS
- Your read and write workloads have separate requirements for scaling,
latency, and consistency.

- Eventual consistency is acceptable for the “read queries”.

- Read replicas can serve as failover databases for High Availability


purposes, it may also help improve performance by alleviating read
traffic from the write database and other read replicas (e.g. having a read
replica specifically for high load read operations, like reporting).
When to consider NOT using CQRS
- You need immediate consistency for the read queries

- The scale of your project does not justify the costs and complexity of
implementing CQRS and multiple databases

- However, the final decision should be discussed in depth before


implementing it in the project, since there are workarounds for these
issues.
Dynamo DB as Write Database and
Aurora/RDS as Read Database
Dynamo DB as Write Database and
Aurora/RDS as Read Database
Benefits:

- Good performance for Write Queries with DynamoDB, while Aurora/RDS offer
good performance and functionality for Read Queries (complex JOINS, etc.)

- DynamoDB and Aurora are fully managed services, reducing business


overhead. They also offer serverless options.

Disadvantages:

- Need to ensure the Lambda function which replicates the data in DynamoDB
to Aurora/RDS works correctly.

- Cost
DynamoDB as Write Database,
OpenSearch as Read Database
Aurora/RDS as Write Database, Read
Replicas as Read Database
Aurora/RDS as Write Database, Read
Replicas as Read Database
Benefits:

- Easier to implement since both databases are of the same type.


Automatic failover/promotion is also easier to manage

- Easier to replicate data from the main database to the read replicas

Disadvantages:

- Not much difference in performance between Write Database and the


Read Database

- Asynchronous replication will make the read replicas Eventually


Consistent instead of Immediately Consistent
Thank you

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy