Transcript
Page 1: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

µService Architecture:A Personal Journey of Discovery

Fred [email protected]@fgeorge52

1

Page 2: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

In the Beginning...

2

Page 3: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2004:1M loc - Largest Certified J2EE Application

3

Page 4: MicroService Architecture

Copyright © 2009 by Fred George

It Started Well...Martin Fowler consulted, then joined ThoughtWorks

4

Page 5: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

What I Found in 2004

✦ 1M locs✦ 2,000 tests✦ 70% success rate on Acceptance Test was Acceptable✦ Bug database with over 1000 entries✦ Still being changed✦ New tests almost non-existent

5

Page 6: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Unit Test Counts

6

Page 7: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

assertNotNull (new Loan(50));

✦ Easy (reasonably) unit test✦ On Saturday without interruptions

7

5 hours later, it passed!

Page 8: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2004:1M loc - Largest Certified J2EE Application

“100K loc trying to get out”

8

Jeff Bay

Page 9: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Why? What Happened?

9

Lazy? Sloppy

Inexperienced!No power to refuse!

Technical Debt

Page 10: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Evolution...

10

Page 11: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2005: SOA in Chinese Bank

11

Cash, Balances Loans Mortgage Insurance

Page 12: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Solution: Pub/Sub

✦ Events “published”✦ Interested applications “subscribe”✦ Applications then “publish” interaction requests✦ UI elements render appropriate interactions

12

Rejected

Page 13: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2004:1M loc - Largest Certified J2EE Application

“100K loc trying to get out”13

“20 5K loc trying to get out”

2005

Page 14: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved. 14

2005: Medical Systems

Information “Nuggets”

Page 15: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved. 15

Information “Nuggets”

Summary

Only relevant until...

From: CAT Scan

About: Jane Doe

Time: 23 Apr 201220:13:45

Urgency: Concern

Validity: 26 Apr 201220:13:45

Rejected

Page 16: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2005: Services for Investment Management✦ Prototyping new system architecture✦ Baysian Service Principles (Jeff Bay)

✦ It’s okay to run more than one version at the same time

✦ You can only deploy one service at a time✦ Decoupling result: Deploying 3 times a day!

16Prototype

Page 17: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2006: Batch Processing Replacement Orders

✦ Client needed to replace parts on cars✦ Many variations based on car, location of car

✦ Vendor estimated 15-18 months✦ Unacceptable to business

17

Page 18: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2006: Batch Processing Replacement Orders

18

Page 19: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Refined Packet Design

19

? Addr ? ? ? ?

? ? ? VIN ? ?

Date ? ? ? Name ?

Page 20: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved. 20

? Addr ? ? ? ?

•Need VIN•Need zzz•Inject aaa

•Need Name•Need rrr•Inject VIN

•Need Addr•Inject Name

Join Table

Delivered

in 9 weeks

Page 21: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

New Observations and Revelations✦ Services are like Classes

✦ Small, crisp conceptualization✦ Services got very tiny (100 loc)

✦ Smalltalk message passing perfect for services✦ Encapsulation

✦ Database segregated among services w/o sharing✦ Service publishes conclusions, not raw data

21

Page 22: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

New Problems and Challenges✦ “WTF is going on ?”

✦ Cycles, lost packets✦ Needed to redefine tracking, logging

✦ Inexperienced team in defining services✦ Approach compromised in Release 2

✦ Won award at TW Tech Day... for being a bad idea!

22Delivered?

Page 23: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

“20 5K loc trying to get out”

2004:1M loc - Largest Certified J2EE Application

23

2005 2006

200 500 loc

Page 24: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Experiences at...

24

Page 25: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2007: Forward Needs to Monitor AdWords Accounts✦ Pub/sub model based on Linda Spaces (tuples)

✦ Segregate databases to services✦ Define agent services for each user✦ Start to automate activities and recommendations

✦ Off-shore for implementation✦ CTO killed it (former Oracle executive)

✦ Replaced with a more traditional, SQL DB-driven solution

25

Rejected

Page 26: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

2008: CardWall

✦ Front-end automated Card Wall in Agile✦ Back-end emerged as a set of services analyzing data

✦ One service, one role✦ Post alerts (with recommendations) to users

✦ Migrated to Hadoop Cluster as it grew

26

Delivered

Page 27: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

New Observations and Revelations✦ Services became disposable✦ Loosely coupled via RESTful Json packets or DB

✦ Albeit still knowledgeable about flow✦ Self-monitoring services replaces Unit Tests✦ Business monitoring replaces Acceptance Tests✦ Services language-agnostic

27

Page 28: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Current State...

28

Page 29: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved. 29

Page 30: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved. 30

Page 31: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Design: Events, not Entities

31

Page 32: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Design: History, not Current

32

Page 33: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Legacy System

33

Data

Biz

ServicesWeb

Data

Biz

ServicesWeb

ETL/Data

Muddling

Reporting

Page 34: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Cloud of Signals

34

Postcode

Name

URL Request

Postal Address

Email Address

Email Read

Server Load

Page 35: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Data Ecosystem

35

Name

URL Request

Postal Address

Email Address

Producers Consumers

App App

Service

Web Server

3rd PartyWeb Hooks

RHive

Monitoring

Apps/Services

Kafka

Page 36: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Cross-sell Tracking

36

Page 37: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

User Paths Through Site

37

Page 38: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Agile Best Practices

✦ Stand ups✦ Story narratives✦ Retrospectives✦ Estimates✦ Iterations✦ Mandatory pairing

38

✦ Unit tests✦ Acceptance tests✦ Refactoring✦ Patterns✦ Continuous integration

Trust wcollocation

Results,not blame

Small,short-lived

apps

Continuousdeployment

Not Used

Page 39: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved. 39

Lazy? Sloppy

Inexperienced!No power to refuse!

What About Technical Debt?

Technical Debt

Page 40: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

Conclusions (so far)...

40

Page 41: MicroService Architecture

Copyright © 2012 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

41

Page 42: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

“Living Software” System✦ Long-lived system; short-lived services (human body)✦ Extremely dynamic with continuous deployments

✦ 5-10 minutes between deployments typical✦ Accept it is complex (especially for testing)

✦ Acceptance test on business outcomes instead✦ Radical impact to processes (Anarchy)✦ There will be a learning curve for developers!

42

Page 43: MicroService Architecture

Copyright © 2012 by Fred George. All rights reserved.

µService Architecture:A Personal Journey of Discovery

Fred [email protected]@fgeorge52

43


Top Related