Rafał Machnik - CQRS as a performance and security booster (Quality Questions Conference)

Post on 27-Jan-2017

53 views 0 download

Transcript of Rafał Machnik - CQRS as a performance and security booster (Quality Questions Conference)

CQRSCQRS as a performance and security booster

What is CQRS?

When CQRS is not suitable?● Where the domain or the business rules are simple.

● Where a simple CRUD-style user interface and the related data access operations

are sufficient.

● For implementation across the whole system. There are specific components of an

overall data management scenario where CQRS can be useful, but it can add

considerable and often unnecessary complexity where it is not actually required.

When CQRS?● Collaborative domains where multiple operations are performed in parallel on the

same data.

● Use with task-based user interfaces (where users are guided through a complex

process as a series of steps), with complex domain models.

● Scenarios where performance of data reads must be fine-tuned separately from

performance of data writes, especially when the read/write ratio is very high, and

when horizontal scaling is required.

CQRS vs performance● Reading operations are separated from writing operations

● Possible different models for reading and writing

CQRS vs security● Responsibility segregation brings more space for security

● More flexibility for reading and writing security rules

● “Asking question shouldn't change the answer”

Related concepts

● Reactive apps

● Task based UI

● Event sourcing

● Eventual consistency

● Example: Reporting app

CQRS and event sourcing

How to test CQRS and event sourcing?AAA

● Arrange - when you set up initial state for a test,

● Act - where you perform actual operation you want to test and

● Assert - when you check results.

Sportech project CQRS example