the hardest part of microservices: your data - christian posta, red hat

37

Upload: datawire

Post on 18-Feb-2017

514 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 2: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

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

Page 3: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

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

Page 4: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 5: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

PeopletrytocopyNet,lix,buttheycanonlycopywhattheysee.Theycopytheresults,nottheprocess.

AdrianCockcro,,formerChiefCloudArchitect,Ne6lix

Page 6: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

“Microservices” is about optimizing … for speed.

Page 7: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Howdoesyourcompanygofast?

Page 8: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Managedependencies.

Page 9: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Wait.Whatisdata?

Page 10: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Whatisone“thing”?

Page 11: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Bookcheckout/purchase TitleSearch

RecommendaBons

WeeklyreporBng

Page 12: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Focusondomainmodels,notdatamodels

•  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

Page 13: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 14: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 15: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 16: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

SBckwiththeseconveniencesaslongasyoucan.Seriously.

Page 17: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

But...

•  Load/sizeistoogreattofitononebox

•  Modules/usecaseshavedifferentread/writecharacterisBcs

•  Queries/joinsaregeOngtoocomplex

•  Securityissues

•  LotsofconflicBngchangestothemodel/schema

•  Needdenormalized,opBmizedindexingengines

•  Wewanttoexplicitlyreducedependenciesondatabetween

ourservices

Page 18: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Fromhereonout,whatwe’resayingis“thankyouoldwork-horsedatabase,we’vegotitfromhere”…

Page 19: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

“Amicroservicehasitsowndatabase”

Page 20: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

We’renowbuildingafull-fledgeddata-centricdistributedsystem.Somethingstoremember…

Page 21: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Planforfailures.

BuildconceptsofBme,delay,

network,andfailuresintothe

designasafirst-classciBzen.

Page 22: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 23: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 24: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

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

Page 25: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

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

getBulkHats()

getBulkHatsForCatsExcept()

wellReallyIJustWantCertainHats()

justExecuteThisSqlForMe()

Page 26: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Weneed“consistency”.Butweexpectfailures.ThisisstarBngtosoundlikeCAP…

Page 27: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Consistencymodels…

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

Page 28: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

ReplicatedDataConsistencyExplainedthroughBaseball(DougTerry)

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)

Page 29: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

MaybewecanusearelaxedconsistencymodelforsomeofthosepreviouslymenBonedusecases…

...andsolvefordata-sharingissueswhiletakinginto

accountthenetworkandfailures.

Page 30: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

ExampleusingsequenBalconsistency…

Page 31: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Whatwe’vedoneisgoneoffandbuiltadatasystemattheapplicaBonlayer.

Page 32: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Andthisiswhattheinternetcompaniesdidalso.(someevenopensource!!)

•  Yelp – MySQL Streamer

https://github.com/Yelp/mysql_streamer

•  LinkedIn – Databus

https://github.com/linkedin/databus

•  Zendesk – Maxwell

https://github.com/zendesk/maxwell

Page 33: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Meetdebezium.io

Page 34: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 35: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

Meetdebezium.io

Page 36: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat
Page 37: The Hardest Part of Microservices: Your Data - Christian Posta, Red Hat

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