Slide 1

Slide 1 text

Handling Failure in Microservice Architectures Matt Heath, Mondo #ndclondon

Slide 2

Slide 2 text

@mattheath

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

1895

Slide 6

Slide 6 text

monoliths traditional dev

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

?

Slide 17

Slide 17 text

DATABASE APPLICATION

Slide 18

Slide 18 text

DATABASE APPLICATION

Slide 19

Slide 19 text

DATABASE DATABASES APPLICATION

Slide 20

Slide 20 text

DATABASE DATABASES APPLICATION SEARCH

Slide 21

Slide 21 text

DATABASE DATABASES APPLICATION CACHE SEARCH

Slide 22

Slide 22 text

DATABASE DATABASES APPLICATION CACHE SEARCH CAT GIFS

Slide 23

Slide 23 text

ALL HAIL THE MONOLITH

Slide 24

Slide 24 text

DATABASE DATABASES APPLICATION CACHE SEARCH CAT GIFS

Slide 25

Slide 25 text

APPLICATION

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

Are your systems reliable?

Slide 29

Slide 29 text

2012 June - RBS - Batch processing causes 3 day outage 2013 December - RBS - Card payments, cash withdrawals 2015 June - RBS lose 600,000 payments 2015 August - HSBC lose 275,000 payments 2015 October - Barclays - Failure of accounts and cards 2016 January - HSBC - 2 day outage of online systems

Slide 30

Slide 30 text

Graceful handling of failure is essential

Slide 31

Slide 31 text

Do microservices make this worse?

Slide 32

Slide 32 text

The Fallacies of Distributed Computing

Slide 33

Slide 33 text

Everything can and will fail

Slide 34

Slide 34 text

Identifying Failure

Slide 35

Slide 35 text

LOAD BALANCER HTTP API & ROUTING LAYER

Slide 36

Slide 36 text

API SERVICE LOAD BALANCER HTTP API & ROUTING LAYER

Slide 37

Slide 37 text

No content

Slide 38

Slide 38 text

/webhooks —-> Webhook API

Slide 39

Slide 39 text

WEBHOOK API LOAD BALANCER HTTP API & ROUTING LAYER

Slide 40

Slide 40 text

WEBHOOK API AUTH SERVICE WEBHOOK SERVICE LOAD BALANCER HTTP API & ROUTING LAYER

Slide 41

Slide 41 text

WEBHOOK API AUTH SERVICE WEBHOOK SERVICE LOAD BALANCER HTTP API & ROUTING LAYER

Slide 42

Slide 42 text

WEBHOOK API AUTH SERVICE WEBHOOK SERVICE LOAD BALANCER HTTP API & ROUTING LAYER

Slide 43

Slide 43 text

WEBHOOK API AUTH SERVICE WEBHOOK SERVICE LOAD BALANCER HTTP API & ROUTING LAYER

Slide 44

Slide 44 text

Error Tracking and Propagation

Slide 45

Slide 45 text

api webhook api webhook service api webhook api webhook service

Slide 46

Slide 46 text

api webhook api webhook service api webhook api webhook service

Slide 47

Slide 47 text

api webhook api webhook service api webhook api webhook service error

Slide 48

Slide 48 text

api webhook api webhook service api webhook api webhook service error SENTRY

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

api webhook api webhook service api webhook api webhook service error SENTRY

Slide 51

Slide 51 text

api webhook api webhook service api webhook api webhook service error SENTRY error partition

Slide 52

Slide 52 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error

Slide 53

Slide 53 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error timeout

Slide 54

Slide 54 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error timeout error timeout

Slide 55

Slide 55 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error error error error duplicated errors

Slide 56

Slide 56 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error error error error

Slide 57

Slide 57 text

8096820c-3b7b-47ec-bce6-1c239252ab40

Slide 58

Slide 58 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error error error error

Slide 59

Slide 59 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error error error error

Slide 60

Slide 60 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error error error error

Slide 61

Slide 61 text

api webhook api webhook service api webhook api webhook service ????? SENTRY error error error error hash & deduplicate

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

Service Healthchecks

Slide 65

Slide 65 text

type Checker func() (error, map[string]string)

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

No content

Slide 68

Slide 68 text

Endpoint error % DB Connection Status Configuration loaded?

Slide 69

Slide 69 text

Instrumentation

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

metrics.Counter(1.0, "cassandra.read.error", 1)

Slide 73

Slide 73 text

metrics.Timing(1.0, "cassandra.read", time.Since(start))

Slide 74

Slide 74 text

STATSD SERVICE A UDP SERVICE B UDP HOST INSTANCES GRAFANA INFLUXDB METRICS

Slide 75

Slide 75 text

TELEGRAF w/ STATSD
 PLUGIN SERVICE A UDP SERVICE B UDP HOST INSTANCES GRAFANA INFLUXDB TAGGED METRICS

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

Handling
 Failure

Slide 78

Slide 78 text

Timing out and moving on

Slide 79

Slide 79 text

Sensible Timeouts?

Slide 80

Slide 80 text

Measure EVERYTHING!

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

TIMEOUT?

Slide 83

Slide 83 text

api webhook api webhook service api webhook api webhook service

Slide 84

Slide 84 text

api webhook api webhook service api webhook api webhook service Client Logic Server

Slide 85

Slide 85 text

api webhook api webhook service api webhook api webhook service Client Logic Server

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

Client Remote Server Circuit Breaker

Slide 88

Slide 88 text

Client Remote Server Circuit Breaker Error! Error!

Slide 89

Slide 89 text

Client Remote Server Circuit Breaker Timeout! Timeout!

Slide 90

Slide 90 text

Client Remote Server Circuit Breaker Circuit Open! OPEN

Slide 91

Slide 91 text

No content

Slide 92

Slide 92 text

Client Remote Server Circuit Breaker Return Error or Cached Results OPEN

Slide 93

Slide 93 text

Topology Management

Slide 94

Slide 94 text

WEBHOOK API LOAD BALANCER HTTP API & ROUTING LAYER WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 95

Slide 95 text

WEBHOOK API LOAD BALANCER HTTP API & ROUTING LAYER WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 96

Slide 96 text

WEBHOOK API LOAD BALANCER HTTP API & ROUTING LAYER WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 97

Slide 97 text

WEBHOOK API LOAD BALANCER HTTP API & ROUTING LAYER WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE SLOW / ERRORS

Slide 98

Slide 98 text

Fanout & Cancellation

Slide 99

Slide 99 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 100

Slide 100 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 101

Slide 101 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 102

Slide 102 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 103

Slide 103 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 104

Slide 104 text

Event Driven Architectures

Slide 105

Slide 105 text

API SERVICE SERVICE A SERVICE B LOAD BALANCER HTTP API & ROUTING LAYER

Slide 106

Slide 106 text

API SERVICE SERVICE A SERVICE B LOAD BALANCER HTTP API & ROUTING LAYER

Slide 107

Slide 107 text

API SERVICE SERVICE A SERVICE B LOAD BALANCER HTTP API & ROUTING LAYER SERVICE C SERVICE D E

Slide 108

Slide 108 text

API SERVICE SERVICE A SERVICE B LOAD BALANCER HTTP API & ROUTING LAYER SERVICE C SERVICE D G E F

Slide 109

Slide 109 text

Retry Strategies

Slide 110

Slide 110 text

Bounded exponential backoff

Slide 111

Slide 111 text

Bounded exponential backoff with Jitter

Slide 112

Slide 112 text

Encouraging Failure?

Slide 113

Slide 113 text

Antifragility

Slide 114

Slide 114 text

Chaos Engineering

Slide 115

Slide 115 text

No content

Slide 116

Slide 116 text

No content

Slide 117

Slide 117 text

Load Failure Degradation

Slide 118

Slide 118 text

Eliminate primaries and special nodes

Slide 119

Slide 119 text

Putting it all together

Slide 120

Slide 120 text

API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns

Slide 121

Slide 121 text

API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns

Slide 122

Slide 122 text

API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns

Slide 123

Slide 123 text

API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns

Slide 124

Slide 124 text

API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns

Slide 125

Slide 125 text

No content

Slide 126

Slide 126 text

API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns API card-api card-processing cards transactions balance transaction-enrichment merchant feed-generator feed apns

Slide 127

Slide 127 text

No content

Slide 128

Slide 128 text

No content

Slide 129

Slide 129 text

#ndclondon Thanks! @mattheath @getmondo

Slide 130

Slide 130 text

ATM: Thomas Hawk
 Bank of Commerce: ABQ Museum Archives IBM System/360: IBM Absorbed: Saxbald Photography Orbital Ion Cannon: www.rom.ac Credits