5 Things I Wish I'd Known about Microservices

Download 5 Things I Wish I'd Known about Microservices

Post on 14-Jan-2017

7.748 views

Category:

Software

3 download

Embed Size (px)

TRANSCRIPT

<ul><li><p>VINCENT KOK DEV MANAGER ATLASSIAN @VINCENTKOK</p><p>Microservices5 things I wish Id known</p></li><li><p>B U I L D I N G M I C R O S E RV I C E S</p><p>I S S U E S</p><p>M O V I N G F O RWA R D</p><p>Agenda</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/fSopv4</p><p>Youve got issues </p><p>https://flic.kr/p/fSopv4</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/7WcQwA</p><p>Slow down </p><p>https://flic.kr/p/7WcQwA</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/bRgBZP</p><p>Lock up </p><p>https://flic.kr/p/bRgBZP</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/bByin8</p><p>Technology will age </p><p>https://flic.kr/p/bByin8</p></li><li><p>The promise of Microservices</p><p>Small Independent lifecycle ReplaceableRight tool</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/aSqP7p</p><p>Steep journey ahead </p><p>https://flic.kr/p/aSqP7p</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/kENTD4</p><p>Fast forward to the top </p><p>https://flic.kr/p/kENTD4</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/kENTD4</p><p>http://images.clipartpanda.com/rainbow-unicorn-cute-tumblr_lj9cy4iZ821qdabzno1_r4_500.png</p><p>No silver bullet </p><p>https://flic.kr/p/kENTD4http://images.clipartpanda.com/rainbow-unicorn-cute-tumblr_lj9cy4iZ821qdabzno1_r4_500.png</p></li><li><p>Examples</p></li><li><p>Confluence</p><p>Connect</p><p>Conversion</p><p>Filestore</p></li><li><p>Identity</p><p>6+AvatarLogin</p></li><li><p>Build</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>Build a pattern </p><p>https://flic.kr/p/8ykpkW</p><p>https://flic.kr/p/8ykpkW</p></li><li><p>The Twelve Factor App</p><p>XI. Logs</p><p>One codebase tracked in revision control, many deploys</p><p>V. Build, release, runStrictly separate build and run stages</p><p>I. Codebase</p><p>Treat logs as event streams</p></li><li><p>Anatomy of a service</p></li><li><p>Health check</p><p>200!200</p></li><li><p>/healthcheck</p><p>{ "avatar": { "details": {}, "isHealthy": true, "metadata": { "hash": "379965ce", "name": "Avatar service", "version": "2.0.8" } }}</p></li><li><p>/healthcheck/details{ "avatar": { "details": { "avatarRepository": { "isHealthy": true }, "crowd": { "isHealthy": true }, "deadlock": { "isHealthy": true</p></li><li><p>1 Build1 Repository</p><p>For every service</p></li><li><p>One Bitbucket repository per service</p></li><li><p>From slow</p><p>MTTR</p></li><li><p>To fast and reliable</p><p>A slightly better MTTR</p></li><li><p>Configure</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/8prXA6</p><p>Prevent different lifecycles </p><p>https://flic.kr/p/8prXA6</p></li><li><p>Layered layout</p><p>Common configuration per environment</p><p>Per serviceCommon configuration per service</p><p>Per environment</p></li><li><p>Simple formatinclude "common.prod.conf"include "service.conf"</p><p>http { port = 8080 interface = "127.0.0.1"}</p><p>recaptcha.key.site = "....."recaptcha.enable = true</p><p>static.asset.base = "...."</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>No secrets </p></li><li><p>Deploy</p></li><li><p>DeployBuild and testCommit to master</p><p>Deployment pipeline</p><p>Release</p></li><li><p>Environments</p><p>Development Staging Production Disaster Recovery</p></li><li><p>Build and upload</p><p>Deployment projects take </p><p>care of the actual deployment</p></li><li><p>Create release from build</p><p>Build release information</p></li><li><p>Feedback per environment</p><p>Versioned release per environment</p></li><li><p>Test</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>Isolation </p><p>https://flic.kr/p/dxUhia</p><p>https://flic.kr/p/dxUhia</p></li><li><p>PDVFunctional testsUnit tests</p><p>Test strategy</p><p>Contract tests</p></li><li><p>Integration tests</p><p>Stub Service mock</p></li><li><p>Stub sample</p></li><li><p>WireMock sample{ "request": { "url": /myresource", "method": POST "Accept": { "matches": application/json } }, "response": { "status": 204 }}</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>Consumer Driven Contract Testing </p><p>https://flic.kr/p/9mjRKW</p><p>https://flic.kr/p/9mjRKW</p></li><li><p>An example</p><p>Service A Service B</p><p>REST</p><p>Consumer Provider</p></li><li><p>Consumer expectation</p><p> uponReceiving("A request by user id for a user") .matching(path = "/Users/1") .willRespondWith(body = userByIdResponse) .during { providerConfig =&gt; Client(providerConfig.url).get("/Users/1) </p><p> must beEqualTo(200, Some(userByIdResponse)) }</p></li><li><p>Consumer side</p><p>HTTP request</p><p>HTTP response</p><p>Client Service Mock PACT</p></li><li><p>Provider side</p><p>HTTP request</p><p>HTTP responsePACT PACT runner Provider</p></li><li><p>PACT Matrix</p><p>Consumer master Consumer prod</p><p>Provider master Latest compatibleProvider </p><p>Compatible </p><p>Provider prod Consumer Compatible Already tested</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>Post Deployment Verification </p><p>https://flic.kr/p/6wHFj5</p><p>https://flic.kr/p/6wHFj5</p></li><li><p>PDV</p><p>Development Staging Production Disaster Recovery</p></li><li><p>Operate</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>100 lbs </p><p>https://flic.kr/p/biy2an</p><p>99% of water </p><p>dehydrate to 98% </p><p>How much do they weigh now? </p><p>https://flic.kr/p/biy2an</p></li><li><p>50lbs</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>What is the uptime of service that depends on 30 services </p><p>with an uptime of 99.99? </p><p>https://flic.kr/p/51TYD1</p><p>https://flic.kr/p/51TYD1</p></li><li><p>99.99 = 99.7%30</p></li><li><p>4m23 to </p><p>&gt; 2h</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>Yield </p><p>https://flic.kr/p/wMx2eU</p><p>https://flic.kr/p/wMx2eU</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>harvest = </p><p>data available / </p><p>total data https://flic.kr/p/3gtrHF</p><p>https://flic.kr/p/3gtrHF</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>Know your system! </p><p>https://flic.kr/p/9b24xc</p><p>https://flic.kr/p/9b24xc</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p></li><li><p>Trace your requests</p><p>X-B3-TraceId : 1X-B3-SpanId : 1</p><p>X-B3-TraceId : 1X-B3-SpanId : 2X-B3-ParentSpanId : 1</p><p>X-B3-TraceId : 1X-B3-SpanId : 3X-B3-ParentSpanId : 2</p><p>X-B3-TraceId : 1X-B3-SpanId : 4X-B3-ParentSpanId : 3</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p></li><li><p>Moving forward</p></li><li><p>5 Things</p></li><li><p> Big cool statistic</p><p> 2,569</p><p> Add-Ons in Marketplace</p><p>https://flic.kr/p/3Esx3o</p><p>More decisions to come </p><p>https://flic.kr/p/3Esx3o</p></li><li><p>Thank you!</p><p>VINCENT KOK DEV MANAGER ATLASSIAN @VINCENTKOK</p></li></ul>