hypermedia-driven orchestration in microservices

54
Hypermedia*Driven Orchestration in Microservices Irakli Nadareishvili * @inadarei Director of Strategy, API Academy March, 2015

Upload: irakli-nadareishvili

Post on 14-Jul-2015

858 views

Category:

Technology


1 download

TRANSCRIPT

Hypermedia*DrivenOrchestration4in4Microservices

Irakli4Nadareishvili * @inadareiDirector(of(Strategy,(API(Academy

March,42015

2 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Marc Andreessen

3 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Marc Andreessen

4 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Marc Andreessen“This%is%a%pattern%that%we%love%to%fund:%unbundle X%from%Y,%but%then%use%the%liberation%of%X%as%leverage%to%do%amazing%

new%things%with%X.”#

5 ©(2015(CA.(ALL(RIGHTS(RESERVED.

“Unbundling”

6 ©(2015(CA.(ALL(RIGHTS(RESERVED.

«unbundled#by»

7 ©(2015(CA.(ALL(RIGHTS(RESERVED.

«unbundled#by»

8 ©(2015(CA.(ALL(RIGHTS(RESERVED.

«unbundled#by»

9 ©(2015(CA.(ALL(RIGHTS(RESERVED.

«unbundled#by»

10 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Irakli(Nadareishvili –@inadarei

Hypermedia*DrivenOrchestration4in4Microservices

11 ©(2015(CA.(ALL(RIGHTS(RESERVED.

What are “Microservices ”?

12 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Martin Fowler:

O http://martinfowler.com/articles/microservices.html

“We(cannot(say(there(is(a(formal(

definition(of(the(microservices

architectural(style,(but(we(can(attempt(

to(describe(what(we(see(as(common(

characteristics(for(architectures(that(fit(

the(label.(�

13 ©(2015(CA.(ALL(RIGHTS(RESERVED.

EVOLUTIONARY4DESIGN

Characteristics of a Microservice Architecture per Fowler:COMPONENTIZATION4VIA4SERVICES

ORGANIZED4AROUND4BUSINESS4CAPABILITIES

PRODUCTS,4NOT44PROJECTS

SMART4ENDPOINTS4AND4DUMB4PIPES

DECENTRALIZED4GOVERNANCE4&4DATA4MANAGEMENT

1

2

3

4

5

INFRASTRUCTURE4AUTOMATION/DESIGN4FOR4FAILURE6

7

14 ©(2015(CA.(ALL(RIGHTS(RESERVED.

We Know What It Is Not:

Monolith

15 ©(2015(CA.(ALL(RIGHTS(RESERVED.

We Know It Is Popular:

16 ©(2015(CA.(ALL(RIGHTS(RESERVED.

17 ©(2015(CA.(ALL(RIGHTS(RESERVED.

It is not just about technology

18 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Unbundling: greatest disruptor of tech industry

“Microservices unbundle'your%business%for%internal%and%[controlled]%external%

disruption”#

– Irakli#Nadareishvili

19 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Microservice Architectureis complex

Uncomfortable truth:

20 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Monolith is brittle, but has order

21 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Microservices: High Degree of Freedom

22 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Most of us are quite awful at designing distributed systems.

Uncomfortable truth:

23 ©(2015(CA.(ALL(RIGHTS(RESERVED.

24 ©(2015(CA.(ALL(RIGHTS(RESERVED.

EVOLUTIONARY4DESIGN

Characteristics of a Microservice Architecture per Fowler:

DECENTRALIZED4GOVERNANCE4&4DATA4MANAGEMENT5

7

25 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Watch-out for tight coupling!

26 ©(2015(CA.(ALL(RIGHTS(RESERVED.

We can build loosely-coupled, evolvable services, by designing

them as Hypermedia APIs

Solution we know works:

27 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Hypermedia per Fielding

Architectural(Styles(and(the(Design(of(NetworkObased(

Software,(2001

O Roy(T.(Fielding

“Hypermedia(is(defined(by(the(

presence(of(application(control(

information(embedded(within,(or(

as(a(layer(above,(the(presentation(

of(information�

28 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Or: response = data + controls

API(server(would(have(to(send(client(

not(just(static data,(but(also(controls(describing(API(affordances.

29 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Challenge by Ioseb Dzmanashvili:Most(common(hypermedia(

controls(facilitate(“a(single(step”.

30 ©(2015(CA.(ALL(RIGHTS(RESERVED.

How do we orchestrate Loosely-coupled microservices

for complex workflows?

31 ©(2015(CA.(ALL(RIGHTS(RESERVED.

#REM: response = data + controls

API(server(would(have(to(send(client(

not(just(static data,(but(also(controls(describing(API(affordances.

32 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Affordances

Theory(of(Affordances,(1979

O James(J.(Gibson

Affordances(are(all("action(possibilities"(

latent(in(the(environment.

33 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Affordances

34 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Affordances

35 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Affordances’re key to a good designImagine(a(car(or(a(building(that(you(couldn't(possibly(

use,(unless(you(had(a(manual.(That(sounds(silly,(we(

don't(build(cars(or(buildings(like(that.(Yet,(that(is(

exactly(how(we(build(APIs(today.

36 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Recognizable Affordances

37 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Commonality Makes Affordances ObviousAre(all(cars(exactly(the(same?(No.(Can(we(do(basic(things(

with(any(car,(once(we(understand(how(cars(in(general(work?(

Yes!(Do(we(need(to(read(a(manual(for(that?(No!

38 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Identify and standardize common set of affordances

We need to:

39 ©(2015(CA.(ALL(RIGHTS(RESERVED.

E*COMMERCE

BOOKING4TRAVEL1

2

Examples:

40 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Booking Travel

41 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Diagram(by:(Clemens(Vasters

source:(http://vasters.com/clemensv/2012/09/01/Sagas.aspx

Saga: Long-Lived Compensating Transactions

42 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Link Relations for Saga:

• rel =(“routingOslip”((new:(microformats)

• rel =(“compensatingtx”((new:(microformats)

@see:(http://rels.messages.io

43 ©(2015(CA.(ALL(RIGHTS(RESERVED.

E-Commerce

44 ©(2015(CA.(ALL(RIGHTS(RESERVED.

BROWSING/DISCOVERY4– “HYPERMEDIA4MAZE”4(AMUNDSEN)

CHECKOUT4– SERVICE4ORCHESTRATION

POST*PURCHASE4– SERVICE4CHOREOGRAPHY

1

2

3

3 Types of Complex Workflows

45 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Maze Problems

46 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Maze+XML

47 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Checkout: Orchestration

Checkout

1.(Collect(Shipping(Info 2.(Billing(Info 3.(Authorize(Payment

4.(PostOpurchase(processing

48 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Orchestration for Wizard-Style WFs:

• rel =(“next”

• rel =(“prev”

Standard(IANA(link(relations:

49 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Post Purchase: Choreography

PostOPurchase(

service

Shipping(Service

EOmail(notification(service

SMSNotification(Service

Purchase(

Completed(event

Push(Notification(Service

«subscribes#to»

50 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Service Choreography

• rel =(“hub”((IANA(standard)

• rel =(“sub”((new:(microformats)

• rel =(“unsub”((new:(microformats)

• rel =(“events”((new:(microformats)

Async and(eventOdriven.(

Standard:(Pubsubhubbub

@see:(http://rels.messages.io

51 ©(2015(CA.(ALL(RIGHTS(RESERVED.

BROWSING/DISCOVERY4– “HYPERMEDIA4MAZE”4(MIKE4AMUNDSEN)

CHECKOUT4– SERVICE4ORCHESTRATION

POST*PURCHASE4– SERVICE4CHOREOGRAPHY

1

2

3

Types of Complex Workflows

DISTRIBUTED4TRANSACTIONS4– SAGA4(HECTOR4GARCIA*MOLINA4&4KENNETH4SALEM4)4

52 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Are there more workflow types?Probably, but: next time!

53 ©(2015(CA.(ALL(RIGHTS(RESERVED.

Microservices❤ Hypermedia-Driven Orchestration

Photo( credit:(Corey( Seeman,( CC(BYONCOSA( 2.0.(https://www.flickr.com/photos/cseeman/14144834659

Director(of(Strategy,(API(Academy

Irakli4Nadareishvili

@inadarei @apiacademy @cainc

https://speakerdeck.com/irakli

linkedin.com/in/inadarei

ca.com