CQRS without event sourcing

53
Thomas PIERRAIN @tpierrain Bruno BOUCARD @brunoboucard Tomasz JASKULA @tjaskula Eric VERNIE @EricVernie CQRS (without Event Sourcing)

Transcript of CQRS without event sourcing

Page 1: CQRS without event sourcing

Thomas PIERRAIN@tpierrain

Bruno BOUCARD@brunoboucard

Tomasz JASKULA@tjaskula

Eric VERNIE@EricVernie

CQRS(without Event Sourcing)

Page 2: CQRS without event sourcing

Why CQRS

Page 3: CQRS without event sourcing

Scalability issues?

Page 4: CQRS without event sourcing

The Pareto Principle

80-20

Root cause

0%0%

80% reading

20% writing

Page 5: CQRS without event sourcing

…only one central component to deal with a wide range

of constraints.

With…

Page 6: CQRS without event sourcing

Do you have those constraints in mindwhile designing your architectures?

A question(for you)

Page 7: CQRS without event sourcing

How to optimize an app that has to scale for massive read accesses?

So…

Page 8: CQRS without event sourcing

This is where CQRS is…

Page 9: CQRS without event sourcing

CQRS (short version)

Page 10: CQRS without event sourcing

CQRS splits the 80s and the 20s

Page 11: CQRS without event sourcing

CQRS splits the 80s and the 20s

20 % of time

80 % of time

Page 12: CQRS without event sourcing

C

Q

R

S

Behind the acronym( powered by Greg YOUNG - @gregyoung )

Page 13: CQRS without event sourcing

Command

Query

Responsibility

Segregation

Behind the acronym

Page 14: CQRS without event sourcing

Command

Query

Responsibility

Segregation

Behind the acronym

Page 15: CQRS without event sourcing

CQRS illustrated

Page 16: CQRS without event sourcing

CQRS illustrated

Page 17: CQRS without event sourcing

CQRS illustrated

Page 18: CQRS without event sourcing

CQRS illustrated

Page 19: CQRS without event sourcing

CQRS illustrated

Page 20: CQRS without event sourcing

CQRS illustrated

Page 21: CQRS without event sourcing

CQRS illustrated

Page 22: CQRS without event sourcing

CQRS illustrated

Page 23: CQRS without event sourcing

CQRS illustrated

Page 24: CQRS without event sourcing

CQRS illustrated

Page 25: CQRS without event sourcing

CQRS illustrated

Page 26: CQRS without event sourcing

CQRS illustrated

Page 27: CQRS without event sourcing

CQRS illustrated

Page 28: CQRS without event sourcing

CQRS illustrated

Page 29: CQRS without event sourcing

CQRS illustrated

Page 30: CQRS without event sourcing

Classical

transactional

databases

RDBMS

(ACID)

« ready-to-eat

data », Caches,

non-normalized

models,

(no SQL)

CQRS illustrated

Page 31: CQRS without event sourcing

CommandTRIGGERS AN ACTION

Modify the state of the system

>> Don’t return data ! <<

Imperative Verb

Ex: BookARoom

QueryASKS FOR AN INFORMATION

Read-only!

Get back data

Imperative Verb

Ex: GetAvailableRooms

EventALREADY HAPPENED

(Immutable)

Past-tenseEx: RoomBooked

Page 32: CQRS without event sourcing

Demo

Page 33: CQRS without event sourcing

Open Source Implementation available on GitHub

2 main parts:

CoreClr (Runtime execution) (C++)

CoreFx (including classes, collections, file systems, xml, etc.) (C#)

ASP.NET Core 1.0 framework relies on it

Classic deployment or

Container deployment (Linux or Windows)

.NET Core// Licensed to the .NET Foundation under one or more agreements.

Page 34: CQRS without event sourcing
Page 35: CQRS without event sourcing
Page 36: CQRS without event sourcing
Page 37: CQRS without event sourcing
Page 38: CQRS without event sourcing

Live coding

Page 39: CQRS without event sourcing

Wrap-up

Page 40: CQRS without event sourcing

Warning!

Page 41: CQRS without event sourcing

…a top-level architecture pattern

Use it for components under stress

Do not generalize its usage for all the components of your platform!

CQRS is not…

Page 42: CQRS without event sourcing

Event Sourcing

Also, CQRS is not…

Page 43: CQRS without event sourcing

CQRS Event Sourcing

but

CQRS != Event Sourcing

Page 44: CQRS without event sourcing

To conclude…

Page 45: CQRS without event sourcing

Well-separated read and write concerns

CQRS is mostly

Queries

Caches, Ready-to-eat data

(no SQL)

CommandsTransactionnal

ACID

Page 46: CQRS without event sourcing

Merci aussi à Rui CARVALHO, Mendel MONTEIRO-BECKERMAN,

Olivier COANET et Clément BOUDEREAU ainsi que Greg YOUNG pour leurs feedbacks et idées pour ce talk.

Page 47: CQRS without event sourcing

CQRS origins

Page 48: CQRS without event sourcing

Origine de CQRS

Page 49: CQRS without event sourcing

Origine de CQRS

Page 50: CQRS without event sourcing

Origine de CQRS

Page 51: CQRS without event sourcing

Wanna play the lab @home?

Follow the white rabbit here:

https://github.com/tpierrain/CQRS/blob/master/LabInstructions.

md

Page 52: CQRS without event sourcing

@microsoftfrance @Technet_France @msdev_fr

@tpierrain @brunoboucard @tjaskula @EricVernie

Page 53: CQRS without event sourcing