Bird
Raised Fist0
HLDsystem_design~20 mins

CQRS (Command Query Responsibility Segregation) in HLD - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CQRS Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding the core principle of CQRS

Which statement best describes the main idea behind CQRS?

ACombining command and query operations into one service to reduce latency.
BUsing a single database for both reading and writing to simplify data management.
CSeparating the system into two parts: one for handling commands (writes) and another for handling queries (reads).
DStoring all data in a cache to speed up both reads and writes.
Attempts:
2 left
💡 Hint

Think about how CQRS splits responsibilities to improve scalability and clarity.

Architecture
intermediate
2:00remaining
Identifying components in a CQRS architecture

In a typical CQRS system, which component is responsible for updating the data store after receiving a command?

ACommand Handler
BEvent Publisher
CRead Repository
DQuery Model
Attempts:
2 left
💡 Hint

Consider which part processes write requests and changes the data.

scaling
advanced
2:00remaining
Scaling reads and writes in CQRS

Which approach best explains how CQRS helps scale read and write workloads independently?

ABy using separate databases for reads and writes, allowing each to be optimized and scaled based on its workload.
BBy merging read and write operations into a single database to reduce complexity.
CBy caching all writes and delaying reads to reduce load on the database.
DBy replicating the write database multiple times without separating reads.
Attempts:
2 left
💡 Hint

Think about how separating responsibilities affects scaling.

tradeoff
advanced
2:00remaining
Tradeoffs of using CQRS

What is a common tradeoff when implementing CQRS in a system?

AElimination of the need for event-driven communication.
BReduced performance because reads and writes are combined into one model.
CSimplified data management by using a single database for all operations.
DIncreased complexity due to managing separate models and eventual consistency challenges.
Attempts:
2 left
💡 Hint

Consider what extra work CQRS introduces beyond simple CRUD.

estimation
expert
2:00remaining
Estimating capacity for a CQRS system

A CQRS system handles 10,000 write commands per second and 100,000 read queries per second. If the write database can handle 15,000 writes per second and the read database can handle 120,000 reads per second, what is the maximum sustainable throughput for the system?

A15,000 writes and 120,000 reads per second
B10,000 writes and 100,000 reads per second
C10,000 writes and 120,000 reads per second
D15,000 writes and 100,000 reads per second
Attempts:
2 left
💡 Hint

The system throughput is limited by the component with the lowest capacity for each operation.