Slide 1

Slide 1 text

Microservices & Go Matt Heath, Monzo

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

Hi, I’m Matt @mattheath

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

monoliths traditional dev

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

No content

Slide 17

Slide 17 text

?

Slide 18

Slide 18 text

Application

Slide 19

Slide 19 text

Application Database

Slide 20

Slide 20 text

Application Database

Slide 21

Slide 21 text

Application Databases

Slide 22

Slide 22 text

Application Databases Search

Slide 23

Slide 23 text

Application Databases Search Caching

Slide 24

Slide 24 text

Application Databases Search Caching CAT GIFS

Slide 25

Slide 25 text

ALL HAIL THE MONOLITH

Slide 26

Slide 26 text

No content

Slide 27

Slide 27 text

Application Databases Search Caching CAT GIFS

Slide 28

Slide 28 text

APPLICATION Application

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

Single Responsibility Principle

Slide 32

Slide 32 text

Bounded Context

Slide 33

Slide 33 text

Well defined Interfaces

Slide 34

Slide 34 text

Composability

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

Simple

Slide 37

Slide 37 text

Lightweight Concurrency

Slide 38

Slide 38 text

// Blocking handleRequest()

Slide 39

Slide 39 text

// Runs concurrently // in a goroutine go handleRequest()

Slide 40

Slide 40 text

Go Routines

Slide 41

Slide 41 text

Channels

Slide 42

Slide 42 text

Static Linking

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

monzo/typhon

Slide 46

Slide 46 text

Service Service

Slide 47

Slide 47 text

Service Service Message Bus

Slide 48

Slide 48 text

Service Service Message Bus Request Queue

Slide 49

Slide 49 text

Service Service Message Bus Service Service Request Queue - Service Discovery - Load Balancing

Slide 50

Slide 50 text

Service Service Message Bus Service Service Pull Request Queue

Slide 51

Slide 51 text

Service Service Message Bus Service Service

Slide 52

Slide 52 text

0 40 80 160 120 Feb 2015 Oct 2016

Slide 53

Slide 53 text

Service Service Message Bus Service Service Client library Server library

Slide 54

Slide 54 text

Service Service Service Service HTTP HTTP

Slide 55

Slide 55 text

Service Discovery Load Balancing Timeouts and Expirations Retries Rate Limiting Connection Pooling Circuit Breaking Failure Detection Metrics and Tracing Interrupts Context Propagation

Slide 56

Slide 56 text

Service Service Service Service HTTP HTTP ?

Slide 57

Slide 57 text

Service Service Service Service HTTP HTTP linkerd

Slide 58

Slide 58 text

Service Discovery Load Balancing Timeouts and Expirations Retries Rate Limiting Connection Pooling Circuit Breaking Failure Detection Metrics and Tracing Interrupts Context Propagation

Slide 59

Slide 59 text

Load Balancer

Slide 60

Slide 60 text

Load Balancer HTTP API & Routing Layer

Slide 61

Slide 61 text

Load Balancer HTTP API & Routing Layer API
 Service

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

/webhooks —-> Webhook API

Slide 64

Slide 64 text

Load Balancer HTTP API & Routing Layer Webhook
 API

Slide 65

Slide 65 text

Auth
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API

Slide 66

Slide 66 text

Auth
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API Database

Slide 67

Slide 67 text

Database Auth
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API Database

Slide 68

Slide 68 text

External Provider Database Auth
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API Database

Slide 69

Slide 69 text

type Service func(req Request) Response

Slide 70

Slide 70 text

router.GET("/", List) router.POST("/", Register) router.DELETE("/:id", Deregister)

Slide 71

Slide 71 text

Making our service reliable

Slide 72

Slide 72 text

+ = ❤

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

Webhook
 Service Webhook
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API

Slide 75

Slide 75 text

Webhook
 Service Webhook
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API

Slide 76

Slide 76 text

Webhook
 Service Webhook
 Service Webhook
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API

Slide 77

Slide 77 text

Webhook
 Service Webhook
 Service Webhook
 Service Webhook
 Service Load Balancer HTTP API & Routing Layer Webhook
 API Slow or
 Errors

Slide 78

Slide 78 text

Event Driven Architecture

Slide 79

Slide 79 text

Service A Service B Load Balancer HTTP API & Routing Layer API Service

Slide 80

Slide 80 text

API Service Service A Service B Load Balancer HTTP API & Routing Layer

Slide 81

Slide 81 text

API Service Service A Service B Load Balancer HTTP API & Routing Layer

Slide 82

Slide 82 text

API Service Service A Service B Load Balancer HTTP API & Routing Layer Service C Service D Service E

Slide 83

Slide 83 text

Context Propagation

Slide 84

Slide 84 text

api api api.customer api.customer service.customer service.customer

Slide 85

Slide 85 text

api api api.customer api.customer service.customer service.customer

Slide 86

Slide 86 text

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

Slide 87

Slide 87 text

api api api.customer api.customer service.customer service.customer

Slide 88

Slide 88 text

api api api.customer api.customer service.customer service.customer

Slide 89

Slide 89 text

package context type Context interface { Deadline() (deadline time.Time, ok bool) Done() <-chan struct{} Err() error Value(key interface{}) interface{} }

Slide 90

Slide 90 text

package context type Context interface { Deadline() (deadline time.Time, ok bool) Done() <-chan struct{} Err() error Value(key interface{}) interface{} }

Slide 91

Slide 91 text

package context type Context interface { Deadline() (deadline time.Time, ok bool) Done() <-chan struct{} Err() error Value(key interface{}) interface{} }

Slide 92

Slide 92 text

api api api.customer api.customer service.customer service.customer

Slide 93

Slide 93 text

api api api.customer api.customer service.customer service.customer SEND RECV SEND RECV RECV SEND RECV SEND

Slide 94

Slide 94 text

api api.customer service.customer SEND RECV SEND RECV RECV SEND RECV SEND phosphor

Slide 95

Slide 95 text

No content

Slide 96

Slide 96 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 97

Slide 97 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 98

Slide 98 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 99

Slide 99 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 100

Slide 100 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 101

Slide 101 text

No content

Slide 102

Slide 102 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 103

Slide 103 text

No content

Slide 104

Slide 104 text

No content

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

No content

Slide 107

Slide 107 text

Small Simple Easy to learn

Slide 108

Slide 108 text

Concurrency Channels

Slide 109

Slide 109 text

Downsides?

Slide 110

Slide 110 text

Starting with Microservices?

Slide 111

Slide 111 text

Thanks! @mattheath @monzo

Slide 112

Slide 112 text

ATM: Thomas Hawk
 Bank of Commerce: ABQ Museum Archives IBM System/360: IBM Absorbed: Saxbald Photography Go Gopher: Renee French Credits

Slide 113

Slide 113 text

No content