Slide 1

Slide 1 text

No content

Slide 2

Slide 2 text

Full slide deck here: h"p://bit.ly/ceposta-hardest-part

Slide 3

Slide 3 text

Twitter: @christianposta Blog: http://blog.christianposta.com Email: [email protected] Christian Posta Principal Architect – Red Hat •  Author “Microservices for Java Developers” •  Committer/contributor Apache Camel, Apache ActiveMQ, Fabric8.io, Apache Kafka, Debezium.io, et. al. •  Worked with large Microservices, web-scale, unicorn company •  Blogger, speaker about DevOps, integration, and microservices

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

People try to copy Net,lix, but they can only copy what they see. They copy the results, not the process. Adrian Cockcro,, former Chief Cloud Architect, Ne6lix

Slide 6

Slide 6 text

“Microservices” is about optimizing … for speed.

Slide 7

Slide 7 text

How does your company go fast?

Slide 8

Slide 8 text

Manage dependencies.

Slide 9

Slide 9 text

Wait. What is data?

Slide 10

Slide 10 text

What is one “thing”?

Slide 11

Slide 11 text

Book checkout / purchase Title Search RecommendaBons Weekly reporBng

Slide 12

Slide 12 text

Focus on domain models, not data models •  Break things into smaller, understandable models •  Surround a model and its “context” with an explicit boundary •  Implement the model in code or get a new model •  Explicitly map between different contexts •  Model transactional boundaries as aggregates

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

SBck with these conveniences as long as you can. Seriously.

Slide 17

Slide 17 text

But ... •  Load/size is too great to fit on one box •  Modules/use cases have different read/write characterisBcs •  Queries/joins are geOng too complex •  Security issues •  Lots of conflicBng changes to the model/schema •  Need denormalized, opBmized indexing engines •  We want to explicitly reduce dependencies on data between our services

Slide 18

Slide 18 text

From here on out, what we’re saying is “thank you old work-horse database, we’ve got it from here”…

Slide 19

Slide 19 text

“A microservice has its own database”

Slide 20

Slide 20 text

We’re now building a full-fledged data-centric distributed system. Some things to remember…

Slide 21

Slide 21 text

Plan for failures. Build concepts of Bme, delay, network, and failures into the design as a first-class ciBzen.

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

h"ps://secure.phabricator.com/book/phabcontrib/arBcle/n_plus_one/

Slide 25

Slide 25 text

h"ps://secure.phabricator.com/book/phabcontrib/arBcle/n_plus_one/ getBulkHats() getBulkHatsForCatsExcept() wellReallyIJustWantCertainHats() justExecuteThisSqlForMe()

Slide 26

Slide 26 text

We need “consistency”. But we expect failures. This is starBng to sound like CAP…

Slide 27

Slide 27 text

Consistency models… h"ps://en.wikipedia.org/wiki/Consistency_model •  Strict consistency (Linearizability) •  Sequential consistency •  Causal consistency •  Processor consistency •  PRAM consistency (FIFO) •  Bounded staleness consistency •  Monotonic read consistency •  Monotonic write consistency •  Read your writes consistency •  Eventual consistency

Slide 28

Slide 28 text

Replicated Data Consistency Explained through Baseball (Doug Terry) h"ps://www.microsoa.com/en-us/research/publicaBon/ replicated-data-consistency-explained-through-baseball/ •  What consistency model do you need, depending on what role you’re playing? •  What consistency model are you willing to pay for? •  Official score keeper? (Linearizability or RMW) •  Umpire? (Linearizability) •  Sports writer? (Bounded staleness, Eventual consistency) •  Radio updates? (Monotonic read, Bounded staleness) •  Statistician (Bounded staleness) •  Friends in the pub (Eventual consistency)

Slide 29

Slide 29 text

Maybe we can use a relaxed consistency model for some of those previously menBoned use cases… ...and solve for data-sharing issues while taking into account the network and failures.

Slide 30

Slide 30 text

Example using sequenBal consistency…

Slide 31

Slide 31 text

What we’ve done is gone off and built a data system at the applicaBon layer.

Slide 32

Slide 32 text

And this is what the internet companies did also. (some even opensource!!) •  Yelp – MySQL Streamer https://github.com/Yelp/mysql_streamer •  LinkedIn – Databus https://github.com/linkedin/databus •  Zendesk – Maxwell https://github.com/zendesk/maxwell

Slide 33

Slide 33 text

Meet debezium.io

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

Meet debezium.io

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Twitter: @christianposta Blog: http://blog.christianposta.com Email: [email protected] Thanks for listening! Time for demo? Full slide deck here: h"p://bit.ly/ceposta-hardest-part