MicroService Architecture
-
Upload
fred-george -
Category
Documents
-
view
13.089 -
download
4
description
Transcript of MicroService Architecture
Copyright © 2012 by Fred George. All rights reserved.
µService Architecture:A Personal Journey of Discovery
Fred [email protected]@fgeorge52
1
Copyright © 2012 by Fred George. All rights reserved.
In the Beginning...
2
Copyright © 2012 by Fred George. All rights reserved.
2004:1M loc - Largest Certified J2EE Application
3
Copyright © 2009 by Fred George
It Started Well...Martin Fowler consulted, then joined ThoughtWorks
4
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
Copyright © 2012 by Fred George. All rights reserved.
Unit Test Counts
6
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!
Copyright © 2012 by Fred George. All rights reserved.
2004:1M loc - Largest Certified J2EE Application
“100K loc trying to get out”
8
Jeff Bay
Copyright © 2012 by Fred George. All rights reserved.
Why? What Happened?
9
Lazy? Sloppy
Inexperienced!No power to refuse!
Technical Debt
Copyright © 2012 by Fred George. All rights reserved.
Evolution...
10
Copyright © 2012 by Fred George. All rights reserved.
2005: SOA in Chinese Bank
11
Cash, Balances Loans Mortgage Insurance
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
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
Copyright © 2012 by Fred George. All rights reserved. 14
2005: Medical Systems
Information “Nuggets”
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
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
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
Copyright © 2012 by Fred George. All rights reserved.
2006: Batch Processing Replacement Orders
18
Copyright © 2012 by Fred George. All rights reserved.
Refined Packet Design
19
? Addr ? ? ? ?
? ? ? VIN ? ?
Date ? ? ? Name ?
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
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
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?
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
Copyright © 2012 by Fred George. All rights reserved.
Experiences at...
24
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
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
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
Copyright © 2012 by Fred George. All rights reserved.
Current State...
28
Copyright © 2012 by Fred George. All rights reserved. 29
Copyright © 2012 by Fred George. All rights reserved. 30
Copyright © 2012 by Fred George. All rights reserved.
Design: Events, not Entities
31
Copyright © 2012 by Fred George. All rights reserved.
Design: History, not Current
32
Copyright © 2012 by Fred George. All rights reserved.
Legacy System
33
Data
Biz
ServicesWeb
Data
Biz
ServicesWeb
ETL/Data
Muddling
Reporting
Copyright © 2012 by Fred George. All rights reserved.
Cloud of Signals
34
Postcode
Name
URL Request
Postal Address
Email Address
Email Read
Server Load
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
Copyright © 2012 by Fred George. All rights reserved.
Cross-sell Tracking
36
Copyright © 2012 by Fred George. All rights reserved.
User Paths Through Site
37
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
Copyright © 2012 by Fred George. All rights reserved. 39
Lazy? Sloppy
Inexperienced!No power to refuse!
What About Technical Debt?
Technical Debt
Copyright © 2012 by Fred George. All rights reserved.
Conclusions (so far)...
40
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
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
Copyright © 2012 by Fred George. All rights reserved.
µService Architecture:A Personal Journey of Discovery
Fred [email protected]@fgeorge52
43