5 things i wish i'd known about microservices

Post on 14-Jan-2017

7.750 Views

Category:

Software

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

VINCENT KOK • DEV MANAGER • ATLASSIAN • @VINCENTKOK

Microservices5 things I wish I’d known

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

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/fSopv4

You’ve got issues

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

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

Slow down

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/bRgBZP

Lock up

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/bByin8

Technology will age

The promise of Microservices

Small Independent lifecycle ReplaceableRight tool

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/aSqP7p

Steep journey ahead

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

https://flic.kr/p/kENTD4

Fast forward to the top

• 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

Examples

Confluence

Connect

Conversion

Filestore

Identity

6+AvatarLogin

Build

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Build a pattern

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

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

Anatomy of a service

Health check

200!200

/healthcheck

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

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

1 Build1 Repository

For every service

One Bitbucket repository per service

From slow

MTTR

To fast and reliable

A slightly better MTTR

Configure

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

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

Prevent different lifecycles

Layered layout

Common configuration per environment

Per serviceCommon configuration per service

Per environment

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 = "...."

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

No secrets

Deploy

DeployBuild and testCommit to master

Deployment pipeline

Release

Environments

Development Staging Production Disaster Recovery

Build and upload

Deployment projects take

care of the actual deployment

Create release from build

Build release information

Feedback per environment

Versioned release per environment

Test

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Isolation

https://flic.kr/p/dxUhia

PDVFunctional testsUnit tests

Test strategy

Contract tests

Integration tests

Stub Service mock

Stub sample

<beans profile="it">

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

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

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Consumer Driven Contract Testing

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

An example

Service A Service B

REST

Consumer Provider

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)) }

Consumer side

HTTP request

HTTP response

Client Service Mock PACT

Provider side

HTTP request

HTTP responsePACT PACT runner Provider

PACT Matrix

Consumer master Consumer prod

Provider master Latest compatibleProvider

Compatible

Provider prod Consumer Compatible Already tested

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Post Deployment Verification

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

PDV

Development Staging Production Disaster Recovery

Operate

• 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?

50lbs

• 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

99.99 = 99.7%30

4m23 to

> 2h

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Yield

https://flic.kr/p/wMx2eU

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

harvest =

data available /

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

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Know your system!

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

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

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

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

Moving forward

5 Things

• Big cool statistic

• 2,569

• Add-Ons in Marketplace

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

More decisions to come

Thank you!

VINCENT KOK • DEV MANAGER • ATLASSIAN • @VINCENTKOK

top related