45
Copyright © 2011- 2014 by Fred George. All rights reserved. 1 Implementing μ Service Architecture s Fred George F red G eorge @ acm .org @ fgeorge52

Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

  • Upload
    vandien

  • View
    223

  • Download
    1

Embed Size (px)

Citation preview

Page 1: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2011-2014 by Fred George. All rights reserved. 1

Implementing µService ArchitecturesFred George [email protected] @fgeorge52

Page 2: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2011-2014 by Fred George. All rights reserved.

Fred George

2

Technologist

Computer networks - 70s

Token ring LAN - 80s

OO - late 80’s

Agile - late 90’s

MicroService Architectures - mid-2000s

Programmer

Since 1968 (Basic)

65,000 hours experience

70 languages

Computer Science Degree 1973

Manager

17 years IBM

Business degree, MIT Sloan School 1985

Product executive, IBM

VP, ThoughtWorks

Co-founder, Outpace in Silicon Valley

Senior Advisor to 3 tech companies

Page 3: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2011-2014 by Fred George. All rights reserved.

Consulting RoleChange Agent

Disruptor

“Hand grenade I am throwing into Development”

CTO describing me to his Vice President

Fred George

2

Page 4: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2011-2014 by Fred George. All rights reserved.

Experiences at…

3

Page 5: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved.

Design: Events, not Entities

4

Page 6: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved.

Design: History, not Current

5

Page 7: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved.

Summary Principles of µServices✦ Very, very small✦ Loosely coupled (including flow)✦ Multiple versions acceptable (encouraged?)✦ Self-execution monitoring of each service✦ Publish interesting “stuff” (w/o requirement)✦ “Application” seems to be poor conceptualization

6

Page 8: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

Rapids, Rivers, and Ponds

7

Page 9: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

High-Performance Bus

8

K a f k a

0MQ

Service

0MQ0MQ

0MQ 0MQ0MQ

Page 10: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved.

Asynchronous Services

9

Service

B u s

Need

Service

Need

Service

Need

Sol’n’sSol’n

Choose Sol’n

✦ Variants easy✦ Graceful degradation

Page 11: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved.

Sample µServices in Action

11

High Capacity Message Bus

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Location Offers Brand Offers

Page 12: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved. 13

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Location Offers Brand Offers

Page served… client accessible

Car_Rent.com Login

Page 13: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

B A

14

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Location Offers Brand Offers

Page served… client accessible

Car_Rent.com Login

AB

A BA B

Page 14: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

B A

15

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Location Offers Brand Offers

Sally logs in as Member

Car_Rent.com Login

A B

Sally

Page 15: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Brand OffersLocation Offers

CD B A

16

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

CD

Page 16: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Brand OffersLocation Offers

CD

B A

17

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

CD

Page 17: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

FE

Brand OffersLocation Offers

CD

B A

18

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

CDEF

Page 18: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

F E

Brand OffersLocation Offers

CD

B A

19

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

CD

EF

Page 19: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

F E

Brand OffersLocation Offers

CD

B A

20

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

CD

EF

C

G

CG

Page 20: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Brand OffersLocation Offers

CD

22

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

EF

CGC

G

Page 21: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Brand OffersLocation Offers

CD

23

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

EF

CGC

G

Page 22: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Brand OffersLocation Offers

CD

23

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

A B

Sally

EF

CGC

GC

H

CH

Page 23: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Brand OffersLocation Offers

24

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally logs in as Member

Car_Rent.com Login

Sally

ECG

CCH

H

H C EH EC

Page 24: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Brand OffersLocation Offers

25

car_rent

Legacy Web

Server

User Offers

Membership

Segmentation

Sally looks in HoustonE

CGC

CH

HLocation: Houston

H

EC

Page 25: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved.

Need Processing

26

Enrichment ServicesChannel Interfaces

Client Biases

Solution Services

Solution Blockers

Solution Selection

Logging / Monitoring

Client

Client++

Service Taxonomy

Page 26: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.Copyright © 2012-2013 by Fred George. All rights reserved. 27

Why µServices?

Page 27: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2011-2014 by Fred George. All rights reserved.

Capital One EffectCapital One runs experiments in a couple of weeks

Envy of CEOs

Enablers:

Dedicated, small teams asking, “What if…?”

Identified, representative demographic sites

Flexible IT systems

28

Page 28: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.Copyright © 2012-2013 by Fred George. All rights reserved. 29

Complementary Process / Tech

Pool of VMs Ops with Development

Event Architecture

Feature-Driven Development

Low-Ceremony Deployment

Page 29: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

Challenge 1

30

Synchronous or Asychronous

Page 30: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.Copyright © 2012-2013 by Fred George. All rights reserved. 31

Two Camps Agree

✦ Very, very small✦ Exploit poly-glot capabilities✦ Multiple versions acceptable✦ Asynchronous is hard for programmers to learn

Page 31: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.Copyright © 2012-2013 by Fred George. All rights reserved. 32

Chad Fowler vs. Fred George✦ Chad: Use Synchronous as default

✦ Algorithms typically described serially ✦ Programmer understanding / productivity

✦ Fred: Use Asynchronous as default ✦ Robustness should be primary goal ✦ Supports better de-coupling ✦ Teach the programmers

Page 32: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved. 33

Challenge 2

µServices or Clojure

Page 33: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

✦ Conceptualization (Job) ✦ Every service has one job ✦ If two jobs, make two services

✦ Encapsulation ✦ Service has its own persistence ✦ If shared persistence, just one service!

Services Like OO Classes

Copyright © 2012-2013 by Fred George. All rights reserved. 34

Page 34: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

Clojure Loves Shared Data

35

X f o r m

X f o r m

X f o r m

X f o r m

? ? ?

Page 35: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved.Copyright © 2012-2013 by Fred George. All rights reserved.

3 Companies - 3 Variants

36

Number

Languages

Coupling

Forward

300+

Ruby, Node.js, Clojure, R, …

DB w cron, RESTful, Kafka bus

Daily Mail

3 + dozens !

Node.js, Clojure

RabbitMQ bus

Outpace

25 "

Clojure

Orchestraton, RabbitMQ bus

Page 36: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved. 37

A New Hope…

Page 37: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

Challenge 3

Deconstructing the Database

38

Page 38: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

How Many Databases?✦ Fortune 100 View:

✦ Entity-oriented; consistent ✦ As few as possible

✦ Micro-service view: ✦ DB per micro-service ✦ Poly-glot (various NoSQL, SQL) + event bus ✦ 10% writable; fewer transactional

39

Page 39: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Sample µServices in Action

40

High Capacity Message Bus

car_rent

Legacy Web

Server

Membership

Segmentation

Location Offers Brand Offers

Redis

SolutionGathering

EventPublishing

300msResponder

Page 40: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2014 by Fred George. All rights reserved.

Sample µServices in Action

41

High Capacity Message Bus

car_rent

Legacy Web

Server

User Offers

Segmentation

Location Offers Brand Offers

Key-valueMembershipEnrichment

JoinOffers

NightlyETL

Page 41: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

Challenge 4

Choosing Architecture and Frameworks

42

Page 42: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2012-2013 by Fred George. All rights reserved. 43

Page 43: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

No Design Patterns Book Yet…

Challenge 5

44

Page 44: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2014 by Fred George. All rights reserved.

Conferences / Meetups Starting…

45

Page 45: Implementing Service Architectures - YOW! Conferences …yowconference.com.au/...ImplementingMicroserviceArchitectures.pdf · DB per micro-service ... µService Architectures Fred

Copyright © 2011-2014 by Fred George. All rights reserved. 46

Implementing µService ArchitecturesFred George [email protected] @fgeorge52