ddd in a distributed world

29
DDD IN A DISTRIBUTED WORLD Gojko Adzic http://gojko.net [email protected] @gojkoadzic

Upload: elliando-dias

Post on 05-Dec-2014

466 views

Category:

Technology


1 download

DESCRIPTION

 

TRANSCRIPT

Page 1: DDD IN A DISTRIBUTED WORLD

DDD IN A DISTRIBUTED WORLD

Gojko Adzic

http://[email protected]

@gojkoadzic

Page 2: DDD IN A DISTRIBUTED WORLD

Aggregates...

Object clusters defining strong relationships…

...objects outside of an aggregate should only reference the aggregate root and not anything

inside it.

Page 3: DDD IN A DISTRIBUTED WORLD

Aggregates are not just about pointers

Page 4: DDD IN A DISTRIBUTED WORLD

Aggregates are not just about pointers

Think of business units of consistency

Page 5: DDD IN A DISTRIBUTED WORLD

Aggregates are not just about pointers

Think of business units of consistency

“a meaningful whole”

Page 6: DDD IN A DISTRIBUTED WORLD

Technical impacts

A natural unit of distribution

Page 7: DDD IN A DISTRIBUTED WORLD

Technical impacts

A natural unit of distribution A natural unit for transactions

Page 8: DDD IN A DISTRIBUTED WORLD

Technical impacts

A natural unit of distribution A natural unit for transactions A natural unit of synchronous work

Page 9: DDD IN A DISTRIBUTED WORLD

Hint #1: If you don't aggregate enough,even the fastest computers

will spin their wheels in vain

http://www.flickr.com/photos/cianginty/

Page 10: DDD IN A DISTRIBUTED WORLD
Page 11: DDD IN A DISTRIBUTED WORLD
Page 12: DDD IN A DISTRIBUTED WORLD
Page 13: DDD IN A DISTRIBUTED WORLD
Page 14: DDD IN A DISTRIBUTED WORLD

Latency

Page 15: DDD IN A DISTRIBUTED WORLD

Aggregate is a meaningful whole...

So whoever needs a part of it probably needs it whole

Page 16: DDD IN A DISTRIBUTED WORLD

Ship entire aggregates straight away to avoid latency

Page 17: DDD IN A DISTRIBUTED WORLD

Hint #2: If you aggregate too much, baggage becomes a problem

http://www.flickr.com/photos/12496504@N06/

Page 18: DDD IN A DISTRIBUTED WORLD

What is the boundary here?

Page 19: DDD IN A DISTRIBUTED WORLD

If you don't need it all, it is probably not an aggregate

Page 20: DDD IN A DISTRIBUTED WORLD

Hint #3: If you don't aggregate enough, things are going to be

broken just when you need them

http://www.flickr.com/photos/nowhere77/

Page 21: DDD IN A DISTRIBUTED WORLD

Aggregates are units of consistency...

so aggregate updates should obey the samurai principle:

Either return successfully or not at all

Page 22: DDD IN A DISTRIBUTED WORLD

An aggregate should be processed synchronously within a transaction

Page 23: DDD IN A DISTRIBUTED WORLD

Hint #4: If you aggregate wrong things, deadlocks galore

http://www.flickr.com/photos/meckleychina/

Page 24: DDD IN A DISTRIBUTED WORLD

What should we lock here?

Page 25: DDD IN A DISTRIBUTED WORLD

When we lock, we should really lock aggregates

Page 26: DDD IN A DISTRIBUTED WORLD

The technical and the business side of aggregates confirm and reinforce

each-other

Page 27: DDD IN A DISTRIBUTED WORLD

Spotting conflicts between them points to problems straight away!

Unless these are resolved, the system is just not going to work

Page 28: DDD IN A DISTRIBUTED WORLD

Summary

Aggregates are a business concept – a unit of consistency and a meaningful whole

Technically they are units of distribution, locking and synchronicity

A conflict between the two sides points to design issues

Getting them just right is a key to making a nicely designed and performant system

Page 29: DDD IN A DISTRIBUTED WORLD

[email protected]://gojko.net@gojkoadzic