380 likes | 514 Views
Christian Posta, principal architect at Red Hat discusses how to manage your data within a microservices architecture at the 2017 Microservices.com Practitioner Summit.
E N D
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
Title Search Book checkout / purchase 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
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
From here on out, what we’re saying is “thank you old work-horse database, we’ve got it from here”…
We’re now building a full-fledged data-centric distributed system. Some things to remember…
Plan for failures. Build concepts of Bme, delay, network, and failures into the design as a first-class ciBzen.
h"ps://secure.phabricator.com/book/phabcontrib/arBcle/n_plus_one/ 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 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) 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.
What we’ve done is gone off 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
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