teams and monoliths - matthew skelton - velocity eu 2016

123
How to break apart a monolithic system safely without destroying your team Matthew Skelton, Skelton Thatcher Consulting @matthewpskelton 07 November 2016, Amsterdam, NL - #velocityconf

Upload: skelton-thatcher-consulting-ltd

Post on 16-Apr-2017

2.615 views

Category:

Software


1 download

TRANSCRIPT

Page 1: Teams and monoliths - Matthew Skelton - Velocity EU 2016

How to break apart a monolithic system safely

without destroying your teamMatthew Skelton, Skelton Thatcher Consulting

@matthewpskelton

07 November 2016, Amsterdam, NL - #velocityconf

Page 2: Teams and monoliths - Matthew Skelton - Velocity EU 2016

TodayCognitive load for teams

‘Monolith’Code Forensics

Team-first boundariesMonolith-splitting recipe

Page 3: Teams and monoliths - Matthew Skelton - Velocity EU 2016

For now, let’s forget:

MicroservicesCQRS / Event Sourcing

Queues(Architectural changes)

Page 4: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 5: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Team-first digital transformation30+ organisations

UK, US, EU, India, China

Page 6: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 7: Teams and monoliths - Matthew Skelton - Velocity EU 2016

How to break apart a monolithic system safely without destroying your

team

Page 8: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Safer, more rapid changes to software systems

(Business Agility)

Page 9: Teams and monoliths - Matthew Skelton - Velocity EU 2016

A ‘team-first’ approach to software subsystem

boundaries

Page 10: Teams and monoliths - Matthew Skelton - Velocity EU 2016

TEAM

Page 11: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 12: Teams and monoliths - Matthew Skelton - Velocity EU 2016

TEAM

capabilitiesappetite & aptitude

understanding

responsibilities

Page 13: Teams and monoliths - Matthew Skelton - Velocity EU 2016

(assumption)

the team is stable, slowly changing, and long-lived

#NoProjects

Page 14: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Conway’s Law

Page 15: Teams and monoliths - Matthew Skelton - Velocity EU 2016

“organizations which design systems ... are constrained to

produce designs which are copies of the communication structures of

these organizations”

– Mel Conway, 1968http://www.melconway.com/Home/Conways_Law.html

Page 16: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Front-end developers

Back-end developers

Page 17: Teams and monoliths - Matthew Skelton - Velocity EU 2016

‘Reverse Conway’Tobbe Gyllebring (@drunkcod)

Page 18: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 19: Teams and monoliths - Matthew Skelton - Velocity EU 2016

homomorphic force

(#Conway #Yawnoc)

HT @allankellynet

(same) (shape)

Page 20: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Cognitive load for teams

Page 21: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Cognitive load

the total amount of mental effort being used in

the working memory(see Sweller, 1988)

Page 22: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Cognitive load

Intrinsic Extraneous (Irrelevant )

Germane (Relevant)

Page 23: Teams and monoliths - Matthew Skelton - Velocity EU 2016

‘Hacking Your Head’: Jo Pearce

See http://www.slideshare.net/JoPearce5/hacking-your-head-managing-information-overload-45-mix

@jdpearce

Page 24: Teams and monoliths - Matthew Skelton - Velocity EU 2016

We have SCIENCE!

Page 25: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Science since 1988 (!)• Driskell et al, 1999 ‘Does Stress Lead to a Loss of Team Perspective?’ Group Dynamics:

Theory, Research, and Practice 3, no. 4 (1999): 291.

• Fan et al, 2010 ‘Learning HMM-Based Cognitive Load Models for Supporting Human-Agent Teamwork’. Cognitive Systems Research 11, no. 1 (2010): 108–119.

• Ilgen & Hollenbeck, 1993 ‘Effective Team Performance under Stress and Normal Conditions: An Experimental Paradigm, Theory and Data for Studying Team Decision Making in Hierarchical Teams with Distributed Expertise’. DTIC Document, 1993.

• Johnston et al, 2002 ‘Application of Cognitive Load Theory to Developing a Measure of Team Decision Efficiency’. DTIC Document, 2002.

• Sweller, John, 1994 ‘Cognitive Load Theory, Learning Difficulty, and Instructional Design’. Learning and Instruction 4 (1994): 295–312.

• Sweller, John, 1988. ‘Cognitive Load during Problem Solving: Effects on Learning’. Cognitive Science 12, no. 2 (1988): 257–285.

Page 26: Teams and monoliths - Matthew Skelton - Velocity EU 2016

“stress impacts teamperformance … by narrowing or weakening the team-level

perspective required foreffective team behavior.”

– Driskell et al, 1999Group Dynamics: Theory, Research, and Practice 1999, Vol. 3, No. 4,291-302

Page 27: Teams and monoliths - Matthew Skelton - Velocity EU 2016

(not just ‘pop’ science!)

Page 28: Teams and monoliths - Matthew Skelton - Velocity EU 2016

‘Monolith’

Page 29: Teams and monoliths - Matthew Skelton - Velocity EU 2016

monolith

μόνο λίθος“single stone”

Reiner Flassig - CC BY-SA 2.0 de - Wikipedia

Page 30: Teams and monoliths - Matthew Skelton - Velocity EU 2016

“Don’t start with a monolithwhen your goal is a

microservices architecture”

– Stefan Tilkov, innoQ

http://martinfowler.com/articles/dont-start-monolith.html

Page 31: Teams and monoliths - Matthew Skelton - Velocity EU 2016

“Start monolithic and extract”

– Tammer Saleh, Pivotal

https://www.infoq.com/presentations/cloud-anti-patterns

Page 32: Teams and monoliths - Matthew Skelton - Velocity EU 2016

A ‘team-first’ approach to software subsystem

boundaries

Page 33: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Types of software monoliths•Application monolith•Joined at the DB•Monolithic build (rebuild everything)•Monolithic releases (coupled)•Monolithic thinking (standardisation)

Page 34: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Application monolith

Single block of codeDeployed as a unit

Page 35: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Joined at the DB

Difficult to change separately (but not impossible)Risk is (probably) elevated

Chris Collyer, http://www.stone-circles.org.uk/stone/pentreifan.htm

Page 36: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolithic builds

One gigantic CI build just to get a new version of any component

Page 37: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolithic releases

Smaller components bundled together into a ‘release’

Page 38: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolithic thinking

‘One-size-fits-all’ for teamsAssumption that minimising variation is A Good Thing

Page 39: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Dangers of splitting a monolith•Reduced domain consistency•Data duplication (unintentional)•Additional operational complexity due to distributed system and async messaging•Degraded UX across the product

Page 40: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 41: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 42: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 43: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Splitting a monolith

Reiner Flassig - CC BY-SA 2.0 de - Wikipedia

Choose the right technique for splitting Understand the nature of the monolith

Page 44: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 45: Teams and monoliths - Matthew Skelton - Velocity EU 2016

‘Fracture planes’ for code•Business domain bounded context•Regulatory compliance•Change cadence•Risk•Performance isolation•User personas•Team location

Page 46: Teams and monoliths - Matthew Skelton - Velocity EU 2016

‘Fracture planes’ for code

Ask: Could we consume this thing as a service?

Page 47: Teams and monoliths - Matthew Skelton - Velocity EU 2016

‘Fracture planes’ for code

Ask: Could we provide this thing as a service?

Page 48: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Code Forensics

Page 49: Teams and monoliths - Matthew Skelton - Velocity EU 2016

ForensicsYour Code as a Crime SceneAdam Tornhill

Page 50: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Adam TornhillCode, Crime, Complexity: Analyzing software with forensic psychologyAdam TornhillTEDxTrondheim

youtube.com/watch?v=qJ_hplxTYJw

Page 51: Teams and monoliths - Matthew Skelton - Velocity EU 2016

‘Code Maat’ tool

Page 52: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Adam Tornhill, http://www.adamtornhill.com/articles/crimescene/codeascrimescene.htm

Code City plus Code Maat forensics

Page 53: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Beware of badly-named subsystems

Page 54: Teams and monoliths - Matthew Skelton - Velocity EU 2016

"information-poor abstract names are magnets for extra [unwanted] responsibilities"

– Adam Tornhillp.185, Your Code as a Crime Scene

Page 55: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Team-first boundaries

Page 56: Teams and monoliths - Matthew Skelton - Velocity EU 2016

DevOpsTopologies.com

Page 57: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Team types

Component team

Platform / ’substrate’ team

Supporting / ‘productivity’ team

Product/Feature team

Page 58: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Team typesde

vops

topo

logies.com Platform / ’substrate’ team

Product/Feature team

Page 59: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Team typesde

vops

topo

logies.com

Component team

Platform / ’substrate’ team

Product/Feature team

Page 60: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Team typesde

vops

topo

logies.com

Component team

Platform / ’substrate’ team

Product/Feature team

Supporting / ‘productivity’ team

Page 61: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Code repositoriesAlign repositories to subsystem boundaries

Avoid monolithic-y repos like TFS** Don’t get me started on TFS, grrr…

Page 62: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Code repositories

Repo 1 Build Test Deploy Run

Repo 2 Build Test Deploy Run

Repo 3 Build Test Deploy Run

Page 63: Teams and monoliths - Matthew Skelton - Velocity EU 2016

“You can use a monorepo only if your organisation has published a

scientific paper on Computer Science. Otherwise, use one repo

per deployable runnable thing.”

– Matthew SkeltonLondonCD meetup group, 11 Oct 2016

Page 64: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Find natural or available ‘fracture planes’ for splitting

a monolith

(with the team in mind)

Page 65: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Industry experienceExamples from recent work with clients

Different monolithsDifferent ‘fracture planes’

Page 66: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Software for R&D teamsCustomers: over 80% of top 20

global pharma companies

Page 67: Teams and monoliths - Matthew Skelton - Velocity EU 2016

2014:Monolithic: builds, releasesPharma GxP: traceabilityChanges slow and tricky

Page 68: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Fracture plane: business domain

Page 69: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 70: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 71: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Fracture plane: technology

Page 72: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Compose with packages Logging for insights

Technology splitsImproved traceability

Page 73: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Major UK broadcaster (TV + online)Increasing digital delivery of content

Page 74: Teams and monoliths - Matthew Skelton - Velocity EU 2016

2014:Wide mix of technologies

Need for visibility of changesNeed for rapid turnaround

Page 75: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Fracture planes: read-only, location & cadence

Page 76: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Split off Reporting (read-only)Split on change cadence

Increased change throughput

Page 77: Teams and monoliths - Matthew Skelton - Velocity EU 2016

UK’s second largest credit reference agency

Customers: major banks + large orgs

Page 78: Teams and monoliths - Matthew Skelton - Velocity EU 2016

2014:6-weekly monolithic releaseOutage-sensitive customers

Page 79: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Fracture planes: risk & business domain

Page 80: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Split releases based on riskAlign teams to value streamsMore rapid release cadence

Page 81: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Software for Internal CommsCustomers: FTSE 100 & Fortune 1000

Page 82: Teams and monoliths - Matthew Skelton - Velocity EU 2016

2015:Successful system (monolithic)

ISO 27001 complianceAim to expand the org (x N)

Page 83: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Fracture plane: business domain

Page 84: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Optimise split for team engagement & personas

Minimise ISO 27001 footprintAided organisation expansion

Page 85: Teams and monoliths - Matthew Skelton - Velocity EU 2016

When not to split a monolith•‘Heritage’ ERP system (‘cloudified’)•No native Unit Test framework•20-30 min startup times•VMs need 56GB RAM (yes)•CI builds take 50 mins

Page 86: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolith-splitting recipeTried and tested!

Page 87: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolith-splitting recipe

1. Instrument the monolith – logging 2. Grok data flows and fault responses3. Align teams to available segments

4. Split off segments one-by-one

Page 88: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Instrument the monolith

Page 89: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Instrument the monolith

Page 90: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Instrument the monolith

Page 91: Teams and monoliths - Matthew Skelton - Velocity EU 2016

search by event

Event ID

{Delivered,InTransit,Arrived}

Page 92: Teams and monoliths - Matthew Skelton - Velocity EU 2016

transaction trace

Correlation ID

612999958…

Page 93: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Technical

Domain

public enum EventID

{

// Badly-initialised logging data

NotSet = 0,

// An unrecognised event has occurred

UnexpectedError = 10000,

ApplicationStarted = 20000,

ApplicationShutdownNoticeReceived = 20001,

PageGenerationStarted = 30000,

PageGenerationCompleted = 30001,

MessageQueued = 40000,

MessagePeeked = 40001,

BasketItemAdded = 60001,

BasketItemRemoved = 60002,

CreditCardDetailsSubmitted = 70001,

// ...

}

Page 94: Teams and monoliths - Matthew Skelton - Velocity EU 2016

BasketItemAdded = 60001

BasketItemRemoved = 60002

Page 95: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Instrument the monolith

Correlation ID Logs

Event ID

Page 96: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 97: Teams and monoliths - Matthew Skelton - Velocity EU 2016

use logging as a channel/vector to

make distributed systems more testable

use logging as a channel/vector to

make distributed systems more testable

Page 98: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Grok data flows and fault responses

Page 99: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Grok data flows and fault responses

Correlation ID

Event ID

Unexpected collaborating subsystems

Undetected fault condition

Page 100: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Grok data flows and fault responses

Correlation ID

Event ID

Adjust subsystem boundaries

Fix poor fault responses

Page 101: Teams and monoliths - Matthew Skelton - Velocity EU 2016

runbooktemplate.info

Run Book dialogue sheets

Page 102: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Align teams to available segments

Page 103: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Align teams to available segments

Page 104: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Align teams to available segmentsMap to business domain

Page 105: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Align teams to available segmentsIdentify likely components or ‘platform’ elements

Page 106: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Split off segments one-by-one

Page 107: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Split off segments one-by-one

Page 108: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Split off segments one-by-oneSeparate:- Builds- Infrastructure- Deployments- Versions- Lifecycle

Page 109: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Team needs / responsibilities / capabilities come first

Page 110: Teams and monoliths - Matthew Skelton - Velocity EU 2016

use logging as a channel/vector to

make distributed systems more testable

Invest in Build & Release Engineering

Page 111: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 112: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolith-splitting recipe *

1. Instrument the monolith – logging 2. Grok data flows and fault responses3. Align teams to available segments

4. Split off segments one-by-one(5. Invest in Build & Release Engineering)

* The simplistic version

Page 113: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolith-splitting recipe *

1. Instrument 2. Grok behaviour

3. Align teams4. Split off segments

5. Invest in Build & Release* The simplistic version

Page 114: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Monolith-splitting recipe *

* The simplistic version

1. Instrument 2. Grok behaviour

3. Align teams4. Split off segments

5. Invest in Build & Release

Page 115: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Determine monolith type(Apply ‘Code Forensics’)

Find ‘fracture planes’Assess cognitive load for teams

Use the monolith-splitting recipe

How to break apart a monolithic system safely

without destroying your team

Page 116: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Further material

Page 117: Teams and monoliths - Matthew Skelton - Velocity EU 2016
Page 118: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Books & articles• Working Effectively with Legacy Code, by Michael Feathers• Building Microservices by Sam Newman (O’Reilly, 2015)• Managing Cognitive Load for Team Learning by Jo Pearce

http://12devsofxmas.co.uk/2015/12/day-3-managing-cognitive-load-for-team-learning/

• Continuous Delivery with Windows and .NET by Matthew Skelton and Chris O’Dell (O’Reilly, 2016) http://cdwithwindows.net/

• Team Guide to Software Operability by Matthew Skelton and Rob Thatcher (Skelton Thatcher Publications, 2016) http://operabilitybook.com/

• Ye Olde Monolith by Pter Pilgrim https://dzone.com/articles/ye-olde-monolith

Page 119: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Training• From Monolith to Microservices (online training) – Sam Newman,

author of Building Microserviceshttp://www.oreilly.com/live-training/from-monolith-to-microservices.html

• Run Book template & Run Book dialogue sheets http://runbooktemplate.info/

Page 120: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Talks & slides• Hacking Your Head – Managing Information Overload, by Jo

Pearce - http://www.slideshare.net/JoPearce5/hacking-your-head-managing-information-overload-45-mix /http://conferences.oreilly.com/oscon/open-source-eu/public/schedule/detail/53013

• Principles of Microservices by Sam Newman @ Devoxx 2015 https://www.youtube.com/watch?v=PFQnNFe27kU

Page 121: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Research papers• Driskell, James E., Eduardo Salas, and Joan Johnston. ‘Does Stress Lead to a Loss of Team

Perspective?’ Group Dynamics: Theory, Research, and Practice 3, no. 4 (1999): 291.• Fan, Xiaocong, Po-Chun Chen, and John Yen. ‘Learning HMM-Based Cognitive Load Models for

Supporting Human-Agent Teamwork’. Cognitive Systems Research 11, no. 1 (2010): 108–119. • Ilgen, Daniel R., and John R. Hollenbeck. ‘Effective Team Performance under Stress and Normal

Conditions: An Experimental Paradigm, Theory and Data for Studying Team Decision Making in Hierarchical Teams with Distributed Expertise’. DTIC Document, 1993. http://oai.dtic.mil/oai/oai?verb=getRecord&metadataPrefix=html&identifier=ADA284683.

• Johnston, Joan H., Stephen M. Fiore, Carol Paris, and C. A. Smith. ‘Application of Cognitive Load Theory to Developing a Measure of Team Decision Efficiency’. DTIC Document, 2002. http://oai.dtic.mil/oai/oai?verb=getRecord&metadataPrefix=html&identifier=ADA525820.

• Sweller, John. ‘Cognitive Load Theory, Learning Difficulty, and Instructional Design’. Learning and Instruction 4 (1994): 295–312.

• Sweller, John. ‘Cognitive Load during Problem Solving: Effects on Learning’. Cognitive Science 12, no. 2 (1988): 257–285.

Page 122: Teams and monoliths - Matthew Skelton - Velocity EU 2016

Determine monolith type(Apply ‘Code Forensics’)

Find ‘fracture planes’Assess cognitive load for teams

Use the monolith-splitting recipe

How to break apart a monolithic system safely

without destroying your team

Page 123: Teams and monoliths - Matthew Skelton - Velocity EU 2016

thank you

Matthew Skelton@matthewpskelton

skeltonthatcher.com