Transcript
Page 1: No Microservice is an Island

No Microservice Is An IslandMichele Titolo

Lead Software Engineer @ Capital One

Page 2: No Microservice is an Island

Microservices Are A Distributed System

Page 3: No Microservice is an Island
Page 4: No Microservice is an Island
Page 5: No Microservice is an Island

SomethingWILL PROBABLY GOWRONG

Page 6: No Microservice is an Island

How Do You Figure Out What’s Wrong?

Page 7: No Microservice is an Island

How Do You Deploy A Fix?

Page 8: No Microservice is an Island

New Challenges

Page 9: No Microservice is an Island

Microservices Are More Than Application Size

Page 10: No Microservice is an Island

Failure Points++

Page 11: No Microservice is an Island

Microservices Need An Ecosystem

Page 12: No Microservice is an Island

Apps Must Contribute

Page 13: No Microservice is an Island

Infrastructure Must Contribute

Page 14: No Microservice is an Island

Otherwise You’ll Play Catch Up

Page 15: No Microservice is an Island

Three Biggest Challenges

Page 16: No Microservice is an Island

Deployment

Page 17: No Microservice is an Island

Scaling

Page 18: No Microservice is an Island

Debugging

Page 19: No Microservice is an Island

Create A Foundation

Page 20: No Microservice is an Island

Deploying Microservices

Page 21: No Microservice is an Island

Characteristics

Page 22: No Microservice is an Island

Small Releases

Page 23: No Microservice is an Island

Frequent Releases

Page 24: No Microservice is an Island

Consistent Releases

Page 25: No Microservice is an Island

Limit Special Snowflakes

Page 26: No Microservice is an Island

Top-Notch Tooling

Page 27: No Microservice is an Island

Automate Every Aspect

Page 28: No Microservice is an Island

🙅

Page 29: No Microservice is an Island

Page 30: No Microservice is an Island

Strategies

Page 31: No Microservice is an Island

Staged Deployments

Page 32: No Microservice is an Island

Canary

Page 33: No Microservice is an Island

R O U T E R

Page 34: No Microservice is an Island

Blue/Green Red/Black

Page 35: No Microservice is an Island

R O U T E R

Page 36: No Microservice is an Island

R O U T E R

Page 37: No Microservice is an Island

R O U T E R

Page 38: No Microservice is an Island

Automatic Rollbacks

Page 39: No Microservice is an Island

How Do You Know A Deployment Is Successful?

Page 40: No Microservice is an Island

What Features Or Tools Need To Exist?

Page 41: No Microservice is an Island

App

Page 42: No Microservice is an Island

- Tests Pass - Health Check - Dependency/Secret

Injection

Page 43: No Microservice is an Island

Robust Tests

Page 44: No Microservice is an Island

Unit And Integration

Page 45: No Microservice is an Island

Frequent Deployments ➡ Frequent Testing

Page 46: No Microservice is an Island

Standardized Health Check

Page 47: No Microservice is an Island

Consume Dependencies And Secrets

Page 48: No Microservice is an Island

Dependencies i.e. URL to database

Page 49: No Microservice is an Island

Secrets i.e. username/password to DB

Page 50: No Microservice is an Island

- Tests Pass - Health Check - Dependency/Secret

Injection

Page 51: No Microservice is an Island

System

Page 52: No Microservice is an Island

Aggregate Health Checks

Page 53: No Microservice is an Island

Show System State

Page 54: No Microservice is an Island

Successful Deployment?

Page 55: No Microservice is an Island

Define “Successful”

Page 56: No Microservice is an Island

Proactive

Page 57: No Microservice is an Island

Report

Page 58: No Microservice is an Island

Bots

Page 59: No Microservice is an Island

Recap

Page 60: No Microservice is an Island

Once a Deployment Is Finished, Everything’s Done?

Page 61: No Microservice is an Island

Distributed Systems Are Constantly Changing

Page 62: No Microservice is an Island

Scaling Microservices

Page 63: No Microservice is an Island

App Has More Or Less Load

Page 64: No Microservice is an Island

Health Tracked

Page 65: No Microservice is an Island

- RAM - CPU - Latency - Requests per second

Page 66: No Microservice is an Island

Custom Metrics

Page 67: No Microservice is an Island

How Do Microservices Scale?

Page 68: No Microservice is an Island

Automation

Page 69: No Microservice is an Island

Smart System

Page 70: No Microservice is an Island

Trigger Scaling

Page 71: No Microservice is an Island

Scale Up Scale Down

Page 72: No Microservice is an Island

Scale Up Scale Down

Page 73: No Microservice is an Island

Deploy New Instances

Page 74: No Microservice is an Island

Monitor Health Checks

Page 75: No Microservice is an Island

Send Traffic To New Instances

Page 76: No Microservice is an Island

Scale Up Scale Down

Page 77: No Microservice is an Island

Instances Aren’t Being Used

Page 78: No Microservice is an Island

Stop Routing Traffic

Page 79: No Microservice is an Island

Gracefully Shutdown

Page 80: No Microservice is an Island

Disconnect

Page 81: No Microservice is an Island

Report Progress

Page 82: No Microservice is an Island

Ultimately Get Removed

Page 83: No Microservice is an Island

Routing Traffic?

Page 84: No Microservice is an Island

Infrastructure++

Page 85: No Microservice is an Island

Load Balancer Service Discovery

Page 86: No Microservice is an Island

Load Balancer Service Discovery

Page 87: No Microservice is an Island

All Cloud Providers Have One Built-In

Page 88: No Microservice is an Island

Attach To Scaling Group

Page 89: No Microservice is an Island

New Instances Registered

Page 90: No Microservice is an Island

Conversely, Instances Going Away Are Removed

Page 91: No Microservice is an Island

Load Balancer Service Discovery

Page 92: No Microservice is an Island

Routes To Healthy Instances

Page 93: No Microservice is an Island

Apps Register

Page 94: No Microservice is an Island

Route Via Convention

Page 95: No Microservice is an Island

A B

Service Discovery

GET /b/foo GET /foo

Page 96: No Microservice is an Island

A 🤢

Service Discovery

GET /b/foo🚫

Page 97: No Microservice is an Island

Knows Health, Can Trigger Scaling Automation

Page 98: No Microservice is an Island

Scaling Only Solves So Many Problems

Page 99: No Microservice is an Island

Debugging Microservices

Page 100: No Microservice is an Island

First You Need To Know There’s A Problem

Page 101: No Microservice is an Island

How?

Page 102: No Microservice is an Island

Alerts

Page 103: No Microservice is an Island

What Qualifies As A Problem?

Page 104: No Microservice is an Island

Varies Per App

Page 105: No Microservice is an Island

RAM, CPU, Latency

Page 106: No Microservice is an Island

Less Obvious, Too

Page 107: No Microservice is an Island

Key Performance Indicator

Page 108: No Microservice is an Island

Alerts Are For Known Issues

Page 109: No Microservice is an Island

Dashboards

Page 110: No Microservice is an Island

How Do You Debug An Issue?

Page 111: No Microservice is an Island

First: Check Problematic App

Page 112: No Microservice is an Island

Pretend Ssh Doesn’t Exist

Page 113: No Microservice is an Island

Next Best Thing: Logs

Page 114: No Microservice is an Island

Log Collection And Aggregation

Page 115: No Microservice is an Island

Configurable Log Levels

Page 116: No Microservice is an Island

Inspect Logs

Page 117: No Microservice is an Island

Non-Trivial Issue ➡ Isolate

Page 118: No Microservice is an Island

Avoid Cascading Failures

Page 119: No Microservice is an Island

How Do You Isolate A Service?

Page 120: No Microservice is an Island

Identify Isolate

Page 121: No Microservice is an Island

Identify Isolate

Page 122: No Microservice is an Island

Q: What Parts Of The System Depend On Another?

Page 123: No Microservice is an Island

Request Tracing

Page 124: No Microservice is an Island
Page 125: No Microservice is an Island

Unique Request Ids

Page 126: No Microservice is an Island

Best As Overlay

Page 127: No Microservice is an Island

Opentracing

Page 128: No Microservice is an Island

Add Header Manually

Page 129: No Microservice is an Island

Identify Isolate

Page 130: No Microservice is an Island

Circuit Breaking

Page 131: No Microservice is an Island

Let App Recover

Page 132: No Microservice is an Island

App Or System

Page 133: No Microservice is an Island

Fail Gracefully

Page 134: No Microservice is an Island

Deploy A Fix

Page 135: No Microservice is an Island

Slowly Start Sending Traffic

Page 136: No Microservice is an Island

Can Be Done Automatically

Page 137: No Microservice is an Island

Built-In Load Balancers Service Discovery

Page 138: No Microservice is an Island

Otherwise Update Manually

Page 139: No Microservice is an Island

Everything Returns To Normal

Page 140: No Microservice is an Island

What If The Problem Isn’t One Of Your Apps?

Page 141: No Microservice is an Island

Do You Have An External Dependency?

Page 142: No Microservice is an Island

No Access To Logs

Page 143: No Microservice is an Island

No Access To Source

Page 144: No Microservice is an Island

You Can’t Deploy A Fix

Page 145: No Microservice is an Island

Fewer Tools

Page 146: No Microservice is an Island

Damage Control

Page 147: No Microservice is an Island

How Limit Impact?

Page 148: No Microservice is an Island

Status Page

Page 149: No Microservice is an Island

Monitor The Status Page

Page 150: No Microservice is an Island

If Status Page Shows No Issue, Raise It

Page 151: No Microservice is an Island

Keeping Your System Healthy

Page 152: No Microservice is an Island

What’s Inside Your Control?

Page 153: No Microservice is an Island

Can’t See Logs

Page 154: No Microservice is an Island

Request Tracing

Page 155: No Microservice is an Island

Circuit Breaking

Page 156: No Microservice is an Island

Degrade Gracefully

Page 157: No Microservice is an Island

Sometimes Infrastructure Fails

Page 158: No Microservice is an Island

Ex: S3 Outage In 2017

Page 159: No Microservice is an Island

Circuit Breaking

Page 160: No Microservice is an Island

To Recap

Page 161: No Microservice is an Island

Debugging Internal Apps

Page 162: No Microservice is an Island

Log, Trace, Circuit Break

Page 163: No Microservice is an Island

Debugging External Apps

Page 164: No Microservice is an Island

Trace And Circuit Break

Page 165: No Microservice is an Island

One Thing All Of These Have In Common…

Page 166: No Microservice is an Island

Metrics

Page 167: No Microservice is an Island

Monitoring

Page 168: No Microservice is an Island

Gain Insights Into Distributed System

Page 169: No Microservice is an Island

Not Free

Page 170: No Microservice is an Island

Apps Updated

Page 171: No Microservice is an Island

Health Checks

Page 172: No Microservice is an Island

Infrastructure Updated

Page 173: No Microservice is an Island

Monitor Health Checks

Page 174: No Microservice is an Island

Gather Information

Page 175: No Microservice is an Island

Create Confidence That System Is Healthy

Page 176: No Microservice is an Island

Creating An Ecosystem For Microservices Is Doable

Page 177: No Microservice is an Island

Requires More Metrics

Page 178: No Microservice is an Island

Requires Smarter Infrastructure

Page 179: No Microservice is an Island

Infrastructure won’t evolve on its own; people need to change their behavior and fundamentally think of what it takes to run an application a different way.

Nova, Kris and Garrison, Justin (2017). Cloud Native Infrastructure. O’Reilley.

Page 180: No Microservice is an Island

Build Software To Manage Software

Page 181: No Microservice is an Island

Build Software To Support A Healthy Ecosystem

Page 182: No Microservice is an Island

Thank You!@micheletitolo

Page 183: No Microservice is an Island

• https://unsplash.com/photos/-lp8sTmF9HA

• https://unsplash.com/photos/Rfflri94rs8

• https://unsplash.com/photos/B87VRCWmpqU

• https://unsplash.com/photos/aLDuLRjZknE

• https://unsplash.com/photos/xal6tVZRCGc

• https://unsplash.com/photos/VRAxb_gNjQQ

Photo Credits


Top Related