You are on page 1of 37

Full slide deck here:

h"p://bit.ly/ceposta-hardest-part
Christian Posta
Principal Architect Red Hat

Twitter: @christianposta
Blog: http://blog.christianposta.com
Email: christian@redhat.com

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
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


Microservices is about optimizing for speed.
How does your company go fast?
Manage dependencies.
Wait. What is data?
What is one thing?
Book checkout / purchase Title Search

Weekly reporBng

RecommendaBons
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
SBck with these conveniences as long as you can.
Seriously.
But ...
Load/size is too great to t on one box
Modules/use cases have dierent read/write characterisBcs
Queries/joins are geOng too complex
Security issues
Lots of conicBng changes to the model/schema
Need denormalized, opBmized indexing engines
We want to explicitly reduce dependencies on data between
our services
From here on out, what were saying is thank you old
work-horse database, weve got it from here
A microservice has its own database
Were now building a full-edged
data-centric distributed system.
Some things to remember
Plan for failures.
Build concepts of Bme, delay,
network, and failures into the
design as a rst-class ciBzen.
h"ps://secure.phabricator.com/book/phabcontrib/arBcle/n_plus_one/
getBulkHats()

getBulkHatsForCatsExcept()

wellReallyIJustWantCertainHats()
justExecuteThisSqlForMe()

h"ps://secure.phabricator.com/book/phabcontrib/arBcle/n_plus_one/
We need consistency. But we expect failures. This is
starBng to sound like CAP
Consistency models

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

h"ps://en.wikipedia.org/wiki/Consistency_model
Replicated Data Consistency Explained through Baseball
(Doug Terry)

What consistency model do you need, depending on


what role youre 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)
h"ps://www.microsoa.com/en-us/research/publicaBon/
replicated-data-consistency-explained-through-baseball/
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.
Example using sequenBal consistency
What weve done is gone o and built a data system
at the applicaBon layer.
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
Meet debezium.io
Meet debezium.io
Thanks for listening! Time for demo?

Twitter: @christianposta
Blog: http://blog.christianposta.com
Email: christian@redhat.com

Full slide deck here:


h"p://bit.ly/ceposta-hardest-part

You might also like