from monoliths to microservices

167
From monoliths to microservices

Upload: tranquynh

Post on 14-Feb-2017

232 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: From monoliths to microservices

From monoliths to microservices

Page 2: From monoliths to microservices

@evanbottcher@bethesque @joneaves

Page 3: From monoliths to microservices

Why?

Page 4: From monoliths to microservices

Why? What?

Page 5: From monoliths to microservices

Why? What? How?

Page 6: From monoliths to microservices

Residential Commercial Media & Developer International

Group

Global A

rchitecture

Property

The Money

People & Experiences

Page 7: From monoliths to microservices

Why?

Page 8: From monoliths to microservices

1. Long release cycle

Page 9: From monoliths to microservices

1. Long release cycle

2. Coupled releases

Page 10: From monoliths to microservices

1. Long release cycle

2. Coupled releases

3. Long defect fix time

Page 11: From monoliths to microservices
Page 12: From monoliths to microservices

Teams at REA are;

self-empowered

Page 13: From monoliths to microservices

Teams at REA are;

self-empowered

value independence

Page 14: From monoliths to microservices

Teams at REA are;

self-empowered

value independence

trusted

Page 15: From monoliths to microservices

Teams at REA are;

self-empowered

value independence

trusted

Page 16: From monoliths to microservices

Vision

Page 17: From monoliths to microservices

rapid deployment

Page 18: From monoliths to microservices

rapid deployment fault tolerant

Page 19: From monoliths to microservices

rapid deployment fault tolerant discoverable

Page 20: From monoliths to microservices

rapid deployment fault tolerant discoverable independent

Page 21: From monoliths to microservices

rapid deployment fault tolerant discoverable independent

Page 22: From monoliths to microservices

?Microservices

Page 23: From monoliths to microservices

1. Narrow responsibility

Microservices

Page 24: From monoliths to microservices

1. Narrow responsibility

2. Small codebase

Microservices

Page 25: From monoliths to microservices

Microservices

1. Narrow responsibility

2. Small codebase

3. There is no #3

Page 26: From monoliths to microservices

Starting the journey

Page 27: From monoliths to microservices

What?

Page 28: From monoliths to microservices

Residential Commercial Media & Developer International

Group

Page 29: From monoliths to microservices

Group

Page 32: From monoliths to microservices

CRM ERP

Customer Relationship Management

Enterprise Resource Planning

Page 33: From monoliths to microservices

CRM ERP

Page 34: From monoliths to microservices

CRM ERP

Billing Payment

Page 35: From monoliths to microservices

CRM ERP

Billing Payment

Page 36: From monoliths to microservices

Billing

Contract

Sales automation

Product rules

Finance

Pricing

Page 37: From monoliths to microservices
Page 38: From monoliths to microservices

Business Systems

Page 39: From monoliths to microservices

Line of Business

Line of Business

Line of Business

Customers

Page 40: From monoliths to microservices

Line of Business

Line of Business

Line of Business

Customers

Ouch!

Page 41: From monoliths to microservices
Page 42: From monoliths to microservices

Billing

Contract

Sales automation

Product rules

Finance

Pricing

Page 43: From monoliths to microservices

Billing

Sales automation

Product rules

Finance

Pricing

Contract

Page 44: From monoliths to microservices

Billing

Product rules

Finance

Pricing

Contract

Page 45: From monoliths to microservices

Billing

Product rules

Finance

Pricing

Contract

New Apps

New Apps

Page 46: From monoliths to microservices

Billing

Product rules

Finance

Pricing

Contract

New Apps

New Apps

New team boundaries?

Page 48: From monoliths to microservices

Strategic Goals Architectural

Principles Design and Delivery

Practices

Enable scalable business More customers/transactions Self-service for customers

Support entry into new markets Flexible operational processes New products and operational processes

Support innovation in existing markets Flexible operational processes New products and operational processes

Reduce inertia Make choices that favour rapid feedback and change, with reduced dependencies across teams.

Eliminate accidental complexity Aggressively retire and replace unnecessarily complex processes, systems, and integrations so that we can focus on the essential complexity.

Consistent interfaces and data flows Eliminate duplication of data and create clear systems of record, with consistent integration interfaces.

No silver bullets Off the shelf solutions deliver early value but create inertia and complexity.

Standard REST/HTTP

Encapsulate legacy

Eliminate integration databases

Consolidate and cleanse data

Published integration model

Small independent Services

Continuous deployment

Minimal customisation of COTS/SAAS

Page 49: From monoliths to microservices

Strategic Goals Architectural

Principles Design and Delivery

Practices

Enable scalable business More customers/transactions Self-service for customers

Support entry into new markets Flexible operational processes New products and operational processes

Support innovation in existing markets Flexible operational processes New products and operational processes

Reduce inertia Make choices that favour rapid feedback and change, with reduced dependencies across teams.

Eliminate accidental complexity Aggressively retire and replace unnecessarily complex processes, systems, and integrations so that we can focus on the essential complexity.

Consistent interfaces and data flows Eliminate duplication of data and create clear systems of record, with consistent integration interfaces.

No silver bullets Off the shelf solutions deliver early value but create inertia and complexity.

Standard REST/HTTP

Encapsulate legacy

Eliminate integration databases

Consolidate and cleanse data

Published integration model

Small independent Services

Continuous deployment

Minimal customisation of COTS/SAAS

Strategic Goals Architectural

Principles Design and Delivery

Practices

Enable scalable business More customers/transactions Self-service for customers

Support entry into new markets Flexible operational processes New products and operational processes

Support innovation in existing markets Flexible operational processes New products and operational processes

Reduce inertia Make choices that favour rapid feedback and change, with reduced dependencies across teams.

Eliminate accidental complexity Aggressively retire and replace unnecessarily complex processes, systems, and integrations so that we can focus on the essential complexity.

Consistent interfaces and data flows Eliminate duplication of data and create clear systems of record, with consistent integration interfaces.

No silver bullets Off the shelf solutions deliver early value but create inertia and complexity.

Standard REST/HTTP

Encapsulate legacy

Eliminate integration databases

Consolidate and cleanse data

Published integration model

Small independent Services

Continuous deployment

Minimal customisation of COTS/SAAS

Strategic Goals Architectural

Principles Design and Delivery

Practices

Enable scalable business More customers/transactions Self-service for customers

Support entry into new markets Flexible operational processes New products and operational processes

Support innovation in existing markets Flexible operational processes New products and operational processes

Reduce inertia Make choices that favour rapid feedback and change, with reduced dependencies across teams.

Eliminate accidental complexity Aggressively retire and replace unnecessarily complex processes, systems, and integrations so that we can focus on the essential complexity.

Consistent interfaces and data flows Eliminate duplication of data and create clear systems of record, with consistent integration interfaces.

No silver bullets Off the shelf solutions deliver early value but create inertia and complexity.

Standard REST/HTTP

Encapsulate legacy

Eliminate integration databases

Consolidate and cleanse data

Published integration model

Small independent Services

Continuous deployment

Minimal customisation of COTS/SAAS

Page 50: From monoliths to microservices

Martin’s first law of distributed objects

Don’t distribute!

Page 51: From monoliths to microservices

Microservices Monoliths

Single service maintainability Fit-for-purpose technology choice Integration Complexity

Environment Provisioning Operational Complexity

Testing Complexity

Page 52: From monoliths to microservices

How?

Page 53: From monoliths to microservices

Netscaler configs. Firewall rules. Name all the things consistently.

Configured package repository. Cron jobs. Service healthcheck

Run the specs. Run code hygiene. Keep all the gems up to date.

Configure monitoring. Enable NRPE. Configure apache.

Build an RPM. Configure dependencies. Ruby version. Configure

Passenger configs. Logrotate. Splunk forwarder. Logger

Create users. Configure NewRelic. Load rake tasks. Load

Connect to a database. Make connection pooling work.

Externalise configuration. Run database migrations. Chkconfigs.

Page 54: From monoliths to microservices

#noops

Page 56: From monoliths to microservices
Page 57: From monoliths to microservices

(source: flickr.com)

#devops

Page 58: From monoliths to microservices

If you build it, you support it

Page 59: From monoliths to microservices

Integration Complexity Environment Provisioning Operational Complexity

Testing Complexity

Single service maintainability Fit-for-purpose technology choice

Team managed infrastructure If you build it, you support it

Microservices Monoliths

Page 60: From monoliths to microservices

Time

# of

Ser

vice

s

3 months

Page 61: From monoliths to microservices

Time

# of

Ser

vice

s

3 months

Page 62: From monoliths to microservices

Time

# of

Ser

vice

s

3 months

2 services!

Page 63: From monoliths to microservices

Condor

Contract Proposals

Pricing

Account Manager

Assignments

Page 64: From monoliths to microservices

Condor

Contract Proposals

Pricing

Account Manager

Assignments

Page 65: From monoliths to microservices

CondorCustomerAcceptance

AcceptedContracts Adapter

Contracts CDM

Contract Proposals

Pricing

Account Manager

Assignments

Page 66: From monoliths to microservices

CondorCustomerAcceptance

AcceptedContracts Adapter

Contracts CDM

Contract Proposals

Pricing

Account Manager

Assignments

Page 67: From monoliths to microservices

CondorCustomerAcceptance

AcceptedContracts Adapter

Contracts CDM

Contract Proposals

Pricing

Account Manager

Assignments

Anti-corruption

Page 69: From monoliths to microservices

‘Stencil’ (Service Template)

Page 70: From monoliths to microservices

Stencil

Page 71: From monoliths to microservices

Stencil ServiceClone

Page 72: From monoliths to microservices

Stencil Service

Service

Service

Service

Service

Service

Page 73: From monoliths to microservices

Stencil Service

Service

Service

Service

Service

Service

Page 74: From monoliths to microservices

Stencil Service

Service

Service

Service

Service

Service

Patch

Page 75: From monoliths to microservices

Harvest a service template(but don’t start by writing one)

Page 76: From monoliths to microservices

Success brings its own problems

Page 77: From monoliths to microservices

Test Prod

Page 78: From monoliths to microservices

Prod

Test

Test

Test

Page 79: From monoliths to microservices

Prod

Test

Test

Test

Page 80: From monoliths to microservices
Page 81: From monoliths to microservices

Slow Easy to break

Hard to fix Scales BADLY

Lots of infrastructure

False negativesLots of set up

Integration Tests

Page 82: From monoliths to microservices

Why do we do integration testing?

Page 83: From monoliths to microservices

Why do we do integration testing?

Page 84: From monoliths to microservices

BugsWhy do we do integration testing?

Page 85: From monoliths to microservices

BugsWhy do we do integration testing?

Page 86: From monoliths to microservices

Bugs ConsequencesWhy do we do integration testing?

Page 87: From monoliths to microservices

Bugs Consequences Time Don’t knowWhy do we do

Page 88: From monoliths to microservices

Consequences Time Don’t know

Page 89: From monoliths to microservices

Time Don’t know Monitoring

Page 90: From monoliths to microservices

Time Don’t know Monitoring

Page 91: From monoliths to microservices

Time Don’t know Monitoring

Communication

Page 92: From monoliths to microservices

Time Don’t know Monitoring

Communication

Cause

Page 93: From monoliths to microservices

Time Don’t know Monitoring

Communication

Cause Logging

Page 94: From monoliths to microservices

Time Don’t know Monitoring

Communication

Cause Logging

Production

Page 95: From monoliths to microservices

Time Don’t know Monitoring

Communication

Cause Logging

Production Approval process

Page 96: From monoliths to microservices

Time Don’t know Monitoring

Communication

Cause Logging

Production Approval process

Integration tests

Page 97: From monoliths to microservices

Monitoring

Communication

Logging

Approval process

Integration tests

Page 98: From monoliths to microservices

Monitoring

Communication

Logging

Approval process

Integration tests

✓✓✓✓

Page 99: From monoliths to microservices

If you build it, you support it

Page 100: From monoliths to microservices

Monitor meaningful things

Page 101: From monoliths to microservices

Just deploy it

Page 102: From monoliths to microservices

Throw away integration tests

Page 103: From monoliths to microservices

A BC P

The problem with mocks

???

???

mock

Page 104: From monoliths to microservices

A BC P

Test symmetry

mock

Page 105: From monoliths to microservices

A BC P

Test symmetry

mock

Page 106: From monoliths to microservices

C P

Pact… how it works

mock

Page 107: From monoliths to microservices

C P

Pact… how it works

mock

Page 108: From monoliths to microservices

C P

pact

Pact… how it works

mock

Page 109: From monoliths to microservices

C P

pact

Pact… how it works

mock

Page 110: From monoliths to microservices

C P

pact

Pact… how it works

mock

Page 111: From monoliths to microservices

Slow Easy to break

Hard to fix Scales BADLY

Lots of infrastructure

False negativesLots of set up

Integration Tests

Page 112: From monoliths to microservices

Fast Stable

Easy to debug Reliable

No extra infrastructure

Low setupScales linearly

Pact

Page 113: From monoliths to microservices

Arrange - set up mock server

Page 114: From monoliths to microservices

Arrange - set up mock server

Page 115: From monoliths to microservices

Arrange - set up mock server

Page 116: From monoliths to microservices

Arrange - set up expectations

Page 117: From monoliths to microservices

Arrange - set up expectations

Page 118: From monoliths to microservices

Arrange - set up expectations

Page 119: From monoliths to microservices

Act and Assert

Page 120: From monoliths to microservices

Act and Assert

Page 121: From monoliths to microservices
Page 122: From monoliths to microservices

Act and Assert

Page 123: From monoliths to microservices

Act and Assert

Page 124: From monoliths to microservices

Act and Assert

Page 125: From monoliths to microservices

Set up test data

Page 126: From monoliths to microservices

Set up test data

Consumer assumed:

Page 127: From monoliths to microservices

Set up test data

Consumer assumed:

Provider complies:

Page 128: From monoliths to microservices

Set up test data

Consumer assumed:

Provider complies:

Page 129: From monoliths to microservices

Verify: Fail

Page 130: From monoliths to microservices

Verify: Success!

Page 131: From monoliths to microservices

https://github.com/realestate-com-au/pact

@pact_up

Page 132: From monoliths to microservices

Fast feedback in isolation +

Early detection +

Rapid recovery

Page 133: From monoliths to microservices

Single service maintainability Fit-for-purpose technology choice

Team managed infrastructure If you build it, you support it

Service Template Consumer Driven Contracts

Early detection Rapid Recovery

Integration Complexity Environment Provisioning Operational Complexity

Testing Complexity

Microservices Monoliths

Page 134: From monoliths to microservices

Time

# of

Ser

vice

s

9 months

15 services

Page 135: From monoliths to microservices

One ‘Poppenservice’

= Two weeks(source: flickr.com)

Page 136: From monoliths to microservices

To the Cloud!

Page 138: From monoliths to microservices
Page 139: From monoliths to microservices

Tribe

Page 140: From monoliths to microservices

Tribe

Squad Squad

Squad

Delivery Engineering

Page 141: From monoliths to microservices

“We aim to remove hurdles … and ensure the whole team has the knowledge to responsibly operate the system.”

- Hydra’s Vision

Page 142: From monoliths to microservices

Single service maintainability Fit-for-purpose technology choice Team managed infrastructure++

If you build it, you support it Service Template

Consumer Driven Contracts Early detection (MTTD)

Rapid Recovery

Integration Complexity Environment Provisioning Operational Complexity

Testing Complexity

Microservices Monoliths

Page 143: From monoliths to microservices

One ‘Poppenservice’ = Two hours

(source: flickr.com)

Page 144: From monoliths to microservices

Time

# of

Ser

vice

s

2 years

60 services

Page 145: From monoliths to microservices

(source: flickr.com)Work in Progress

Page 146: From monoliths to microservices

Sharing things is hard

Page 147: From monoliths to microservices

Service

Page 148: From monoliths to microservices

Service Service

Page 149: From monoliths to microservices

Service Service Service

Page 150: From monoliths to microservices

Service Service Service

Library

Page 151: From monoliths to microservices

Service Service Service

Library

ServiceService

Page 152: From monoliths to microservices

Service Service Service

Library

ServiceService

Service Service Service ServiceService

Service Service Service ServiceService

Service Service Service ServiceService

Page 153: From monoliths to microservices

Service Service Service

Library

ServiceService

Service Service Service ServiceService

Service Service Service ServiceService

Service Service Service ServiceService

Page 154: From monoliths to microservices

Sharing == Coupling

Page 155: From monoliths to microservices
Page 156: From monoliths to microservices
Page 157: From monoliths to microservices

My Tribe

All of REA

My Squad

Page 158: From monoliths to microservices

Be cautious about shared stuff

(copy/paste may not be wrong)

Page 159: From monoliths to microservices

Service Custodians

Page 160: From monoliths to microservices

Establish Service Custodianship*

(*it’s REALLY hard to make work)

Page 161: From monoliths to microservices

Why?

Page 162: From monoliths to microservices

Why? What?

Page 163: From monoliths to microservices

Why? What? How?

Page 164: From monoliths to microservices

Caution.

Page 165: From monoliths to microservices

Time

# of

Ser

vice

s

Microservices is a long term strategy

Page 166: From monoliths to microservices

Fast feedback in isolation Rapid Recovery

Delivery Engineering Deliberate sharing

Service Custodianship

If you build it, you support it Harvest a service template Early detection of failures

Microservices is a long term strategy

Page 167: From monoliths to microservices

Thank You!

@evanbottcher@bethesque @joneaves