Microservices Architecture - The Blind Spots

Post on 16-Jan-2017

355 views 1 download

Transcript of Microservices Architecture - The Blind Spots

Microservices Architecture:The Blind Spots

Irakli Nadareishvili,

Director of Strategy, API Academy

CA Technologies

Deck:http://bit.ly/microservices-blindspots

2 ©2015CA.ALLRIGHTSRESERVED. inadarei

3 ©2015CA.ALLRIGHTSRESERVED. inadarei

#1What Drives Microservices Adoption?

¯\_(ツ)_/¯

4 ©2015CA.ALLRIGHTSRESERVED. inadarei

5 ©2015CA.ALLRIGHTSRESERVED. inadarei

TechnologyHeterogeneityPartitionedScalability(permicroservice)IndependentDeploymentsCompose-abilityOptimizedforReplace-ability

1

2

3

4

5

Key Benefits of Microservices (as of 2015)

6 ©2015CA.ALLRIGHTSRESERVED. inadarei

Motivations for Adoption Will ChangeThereasonswhyMSAbecamepopulararenotthesamereasonswhyitwillbecomeubiquitous

7 ©2015CA.ALLRIGHTSRESERVED. inadarei

Docker is a "gateway drug" for MSA

8 ©2015CA.ALLRIGHTSRESERVED. inadarei

Containerization will drive MSA Adoptionto the extent that:

Microservices won't be a "choice"

Prediction:

9 ©2015CA.ALLRIGHTSRESERVED. inadarei

#2Current Focus Is Too Code-Centric

10 ©2015CA.ALLRIGHTSRESERVED. inadarei

Caution: Coupling of service interfaces is every bit as toxic as the code one, and can render entire architecture useless.

Hypermedia design, with its high degree of interface de-coupling can be of huge help here.

11 ©2015CA.ALLRIGHTSRESERVED. inadarei

#3Decentralized Data

12 ©2015CA.ALLRIGHTSRESERVED. inadarei

13 ©2015CA.ALLRIGHTSRESERVED. inadarei

DDD & Bounded Contexts

14 ©2015CA.ALLRIGHTSRESERVED. inadarei

Bounded Context = Capabilities.

“In your organization, you should be thinking not in terms of data that is shared, but about the capabilities those contexts provide the rest of the domain.”

– Sam Newman, Building Microservices

15 ©2015CA.ALLRIGHTSRESERVED. inadarei

16 ©2015CA.ALLRIGHTSRESERVED. inadarei

“Bounded context should be asbig as it needs to be in order tofully express its completeUbiquitous Language”

– Vaughn Vernon, Implementing Domain –Driven Design.

17 ©2015CA.ALLRIGHTSRESERVED. inadarei

Inherent Conflict:Business teamsactuallydon'tfavorsmallboundedcontexts(duetodiff.ubiquitouslanguage).

Fortech:continuousIntegrationiseasierwithsmallerteamsandcodebases.

18 ©2015CA.ALLRIGHTSRESERVED. inadarei

In general: DDD alone will not be able to give you small enough microservices and/or solve data embedding requirements.

19 ©2015CA.ALLRIGHTSRESERVED. inadarei

Data Storage Alternative: Event Sourcing & CQRS

20 ©2015CA.ALLRIGHTSRESERVED. inadarei

"Current State"-Oriented System Model

PatientDemographics

ClinicalNotes(3)

BillingInformation

Insurances(2)

Visits(3)

21 ©2015CA.ALLRIGHTSRESERVED. inadarei

Event SourcingUse an append-only store to record the full series of events that describe actions taken on data in a domain, rather than storing just the current state, so that the store can be used to materialize the domain objects.

https://msdn.microsoft.com/en-gb/library/dn589792.aspx

22 ©2015CA.ALLRIGHTSRESERVED. inadarei

"Event Sourcing is all about storing facts and any time you have "state" (structural models) – they are first-level derivative off of your facts.

And they are transient."

- Greg Young

23 ©2015CA.ALLRIGHTSRESERVED. inadarei

Events-based Model

PatientCreated

InsuranceAdded

InsuranceAdded

BillingInfoAdded

Visit'sClinicalNoteAdded

Visit'sClinicalNoteAdded

Visit'sClinicalNoteAdded

Visit'sClinicalNoteAdded

Visit'sClinicalNoteAdded

Visit'sClinicalNoteAdded

Visit'sClinicalNoteAdded

VisitAdded

VisitAdded

VisitAdded

24 ©2015CA.ALLRIGHTSRESERVED. inadarei

Command and Query Responsibility Segregation (CQRS)

Segregate operations that read data from operations that update data by using separate interfaces.

This pattern can maximize performance, scalability, and security; support evolution of the system over time through higher flexibility; and prevent update commands from causing merge conflicts at the domain level.

https://msdn.microsoft.com/en-us/library/dn568103.aspx

25 ©2015CA.ALLRIGHTSRESERVED. inadarei

"Patient Visits" Microservice

VisitMessageQueue

EventStore(e.g.Cassandra)

"List Patient Visits by a Doctor" Microservice

Query IndexStore(e.g.ElasticSearch)

Validation

26 ©2015CA.ALLRIGHTSRESERVED. inadarei

What About Them Transactions?

Use: Sagas (Long-LivedDistributedTransactions)

@see:http://vasters.com/clemensv/2012/09/01/Sagas.aspx

Designedby:HectorGarcia-Molina&KennethSalem,Princeton,1987

27 ©2015CA.ALLRIGHTSRESERVED. inadarei

One More Thing…

28 ©2015CA.ALLRIGHTSRESERVED. inadarei

http://martinfowler.com/bliki/MicroservicePrerequisites.html

I really, really hated this message, so I did smth. about it

29 ©2015CA.ALLRIGHTSRESERVED. inadarei

https://github.com/apiacademy/microservices-deployment

DirectorofStrategy,APIAcademyIrakliNadareishvili

@inadarei

@apiacademy

@cainc

http://bit.ly/microservices-blindspots