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

12
CQRS CQRS as a performance and security booster

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

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

CQRSCQRS as a performance and security booster

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

What is CQRS?

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

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.

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

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.

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

CQRS vs performance● Reading operations are separated from writing operations

● Possible different models for reading and writing

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

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”

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

Related concepts

● Reactive apps

● Task based UI

● Event sourcing

● Eventual consistency

● Example: Reporting app

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

CQRS and event sourcing

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

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.

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

Sportech project CQRS example