5 things i wish i'd known about microservices

67
VINCENT KOK DEV MANAGER ATLASSIAN @VINCENTKOK Microservices 5 things I wish I’d known

Upload: atlassian

Post on 14-Jan-2017

7.750 views

Category:

Software


3 download

TRANSCRIPT

Page 1: 5 Things I Wish I'd Known about Microservices

VINCENT KOK • DEV MANAGER • ATLASSIAN • @VINCENTKOK

Microservices5 things I wish I’d known

Page 2: 5 Things I Wish I'd Known about Microservices

B U I L D I N G M I C R O S E RV I C E S

I S S U E S

M O V I N G F O RWA R D

Agenda

Page 3: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/fSopv4

You’ve got issues

Page 4: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/7WcQwA

Slow down

Page 5: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/bRgBZP

Lock up

Page 6: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/bByin8

Technology will age

Page 7: 5 Things I Wish I'd Known about Microservices

The promise of Microservices

Small Independent lifecycle ReplaceableRight tool

Page 8: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/aSqP7p

Steep journey ahead

Page 9: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/kENTD4

Fast forward to the top

Page 10: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/kENTD4

http://images.clipartpanda.com/rainbow-unicorn-cute-tumblr_lj9cy4iZ821qdabzno1_r4_500.png

No silver bullet

Page 11: 5 Things I Wish I'd Known about Microservices

Examples

Page 12: 5 Things I Wish I'd Known about Microservices

Confluence

Connect

Conversion

Filestore

Page 13: 5 Things I Wish I'd Known about Microservices

Identity

6+AvatarLogin

Page 14: 5 Things I Wish I'd Known about Microservices

Build

Page 15: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Build a pattern

https://flic.kr/p/8ykpkW

Page 16: 5 Things I Wish I'd Known about Microservices

The Twelve Factor App

XI. Logs

One codebase tracked in revision control, many deploys

V. Build, release, runStrictly separate build and run stages

I. Codebase

Treat logs as event streams

Page 17: 5 Things I Wish I'd Known about Microservices

Anatomy of a service

Page 18: 5 Things I Wish I'd Known about Microservices

Health check

200!200

Page 19: 5 Things I Wish I'd Known about Microservices

/healthcheck

{ "avatar": { "details": {}, "isHealthy": true, "metadata": { "hash": "379965ce", "name": "Avatar service", "version": "2.0.8" } }}

Page 20: 5 Things I Wish I'd Known about Microservices

/healthcheck/details{ "avatar": { "details": { "avatarRepository": { "isHealthy": true }, "crowd": { "isHealthy": true }, "deadlock": { "isHealthy": true

Page 21: 5 Things I Wish I'd Known about Microservices

1 Build1 Repository

For every service

Page 22: 5 Things I Wish I'd Known about Microservices

One Bitbucket repository per service

Page 23: 5 Things I Wish I'd Known about Microservices

From slow

MTTR

Page 24: 5 Things I Wish I'd Known about Microservices

To fast and reliable

A slightly better MTTR

Page 25: 5 Things I Wish I'd Known about Microservices

Configure

Page 26: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/8prXA6

Prevent different lifecycles

Page 27: 5 Things I Wish I'd Known about Microservices

Layered layout

Common configuration per environment

Per serviceCommon configuration per service

Per environment

Page 28: 5 Things I Wish I'd Known about Microservices

Simple formatinclude "common.prod.conf"include "service.conf"

http { port = 8080 interface = "127.0.0.1"}

recaptcha.key.site = "....."recaptcha.enable = true

static.asset.base = "...."

Page 29: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

No secrets

Page 30: 5 Things I Wish I'd Known about Microservices

Deploy

Page 31: 5 Things I Wish I'd Known about Microservices

DeployBuild and testCommit to master

Deployment pipeline

Release

Page 32: 5 Things I Wish I'd Known about Microservices

Environments

Development Staging Production Disaster Recovery

Page 33: 5 Things I Wish I'd Known about Microservices

Build and upload

Deployment projects take

care of the actual deployment

Page 34: 5 Things I Wish I'd Known about Microservices

Create release from build

Build release information

Page 35: 5 Things I Wish I'd Known about Microservices

Feedback per environment

Versioned release per environment

Page 36: 5 Things I Wish I'd Known about Microservices

Test

Page 37: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Isolation

https://flic.kr/p/dxUhia

Page 38: 5 Things I Wish I'd Known about Microservices

PDVFunctional testsUnit tests

Test strategy

Contract tests

Page 39: 5 Things I Wish I'd Known about Microservices

Integration tests

Stub Service mock

Page 40: 5 Things I Wish I'd Known about Microservices

Stub sample

<beans profile="it">

<bean id="myClient" class=“com.mycompany.MyStub”/> </beans>

Page 41: 5 Things I Wish I'd Known about Microservices

WireMock sample{ "request": { "url": “/myresource", "method": “POST” "Accept": { "matches": “application/json” } }, "response": { "status": 204 }}

Page 42: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Consumer Driven Contract Testing

https://flic.kr/p/9mjRKW

Page 43: 5 Things I Wish I'd Known about Microservices

An example

Service A Service B

REST

Consumer Provider

Page 44: 5 Things I Wish I'd Known about Microservices

Consumer expectation

uponReceiving("A request by user id for a user") .matching(path = "/Users/1") .willRespondWith(body = userByIdResponse) .during { providerConfig => Client(providerConfig.url).get("/Users/1)

must beEqualTo(200, Some(userByIdResponse)) }

Page 45: 5 Things I Wish I'd Known about Microservices

Consumer side

HTTP request

HTTP response

Client Service Mock PACT

Page 46: 5 Things I Wish I'd Known about Microservices

Provider side

HTTP request

HTTP responsePACT PACT runner Provider

Page 47: 5 Things I Wish I'd Known about Microservices

PACT Matrix

Consumer master Consumer prod

Provider master Latest compatibleProvider

Compatible

Provider prod Consumer Compatible Already tested

Page 48: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Post Deployment Verification

https://flic.kr/p/6wHFj5

Page 49: 5 Things I Wish I'd Known about Microservices

PDV

Development Staging Production Disaster Recovery

Page 50: 5 Things I Wish I'd Known about Microservices

Operate

Page 51: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

100 lbs

https://flic.kr/p/biy2an

99% of water

dehydrate to 98%

How much do they weigh now?

Page 52: 5 Things I Wish I'd Known about Microservices

50lbs

Page 53: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

What is the uptime of service that depends on 30 services

with an uptime of 99.99?

https://flic.kr/p/51TYD1

Page 54: 5 Things I Wish I'd Known about Microservices

99.99 = 99.7%30

Page 55: 5 Things I Wish I'd Known about Microservices

4m23 to

> 2h

Page 56: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Yield

https://flic.kr/p/wMx2eU

Page 57: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

harvest =

data available /

total data https://flic.kr/p/3gtrHF

Page 58: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Know your system!

https://flic.kr/p/9b24xc

Page 59: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Page 60: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Page 61: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Page 62: 5 Things I Wish I'd Known about Microservices

Trace your requests

X-B3-TraceId : 1X-B3-SpanId : 1

X-B3-TraceId : 1X-B3-SpanId : 2X-B3-ParentSpanId : 1

X-B3-TraceId : 1X-B3-SpanId : 3X-B3-ParentSpanId : 2

X-B3-TraceId : 1X-B3-SpanId : 4X-B3-ParentSpanId : 3

Page 63: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Page 64: 5 Things I Wish I'd Known about Microservices

Moving forward

Page 65: 5 Things I Wish I'd Known about Microservices

5 Things

Page 66: 5 Things I Wish I'd Known about Microservices

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/3Esx3o

More decisions to come

Page 67: 5 Things I Wish I'd Known about Microservices

Thank you!

VINCENT KOK • DEV MANAGER • ATLASSIAN • @VINCENTKOK