Slide 1

Slide 1 text


 Go and Microservices Matt Heath, Monzo

Slide 2

Slide 2 text

Hi, I’m Matt @mattheath

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

A UK banking licence is authorised by the PRA and regulated by the PRA and FCA1, allowing deposit- taking and balance sheet lending. Once granted, it allows firms to passport across Europe, accessing This is followed by a “mobilisation” phase during which final capital is raised and IT systems are completed, before launching to the public. We received a UK banking licence in August 2016! FEB 2015 JAN 2016 JAN 2017 MAR FEB FEB APR MAR MAR APR MAY JUN JUL MAY APR JUN MAY JUL JUN AUG JUL SEP AUG NOV SEP DEC NOV DEC PRE APPLICATION APPLICATION MOBILISATION LAUNCH LICENCE WITH RESTRICTIONS 50K MAX DEPOSIT WE ARE HERE A UK banking licence is authorised by the PRA and regulated by the PRA and FCA1, allowing deposit- taking and balance sheet lending. Once granted, it allows firms to passport across Europe, accessing This is followed by a “mobilisation” phase during which final capital is raised and IT systems are completed, before launching to the public. We received a UK banking licence in August 2016! JAN 2016 JAN 2017 MAR FEB FEB APR MAR MAR APR MAY JUN JUL MAY APR JUN MAY JUL JUN AUG JUL SEP AUG NOV SEP DEC NOV DEC E APPLICATION APPLICATION MOBILISATION LAUNCH LICENCE WITH RESTRICTIONS WE ARE HERE AUG
 2017 JAN
 2016 Feb
 2015 APR
 2017 PREPAID
 LAUNCH LICENCE WITH RESTRICTIONS WE ARE HERE A UK banking licence is authorised by the PRA and regulated by the PRA and FCA1, allowing deposit- taking and balance sheet lending. Once granted, it allows firms to passport across Europe, accessing This is followed by a “mobilisation” phase during which final capital is raised and IT systems are completed, before launching to the public. We received a UK banking licence in August 2016! FEB 2015 JAN 2016 JAN 2017 MAR FEB FEB APR MAR MAR APR MAY APR JUN MAY JUL JUN AUG JUL SEP AUG NOV SEP DEC NOV DEC PRE APPLICATION APPLICATION MOBILISATION LICENCE WITH RESTRICTIONS WE ARE HERE

Slide 6

Slide 6 text

No content

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

No content

Slide 17

Slide 17 text

Simple Effective Scalable

Slide 18

Slide 18 text

Simplicity

Slide 19

Slide 19 text

Lightweight Concurrency

Slide 20

Slide 20 text

Goroutines

Slide 21

Slide 21 text

// Blocking function call handleRequest()

Slide 22

Slide 22 text

// Function runs concurrently go handleRequest()

Slide 23

Slide 23 text

package main func main() { go handleRequest() // … }

Slide 24

Slide 24 text

package main func main() { go handleRequest() // … } main

Slide 25

Slide 25 text

package main func main() { go handleRequest() // … } handleRequest main

Slide 26

Slide 26 text

"Do not communicate by sharing memory; instead, share memory by communicating." - Effective Go

Slide 27

Slide 27 text

Channels

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

No content

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Digging
 Deeper

Slide 33

Slide 33 text

Scheduling Goroutines

Slide 34

Slide 34 text

Managing Memory

Slide 35

Slide 35 text

Language Stability

Slide 36

Slide 36 text

Putting it all together

Slide 37

Slide 37 text

But, “microservices”?

Slide 38

Slide 38 text

Low overheads

Slide 39

Slide 39 text

Simple deployment

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

monzo/typhon

Slide 43

Slide 43 text

type Service func(req Request) Response

Slide 44

Slide 44 text

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

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

// Handler is your Lambda function handler func Handler(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { ... } func main() { lambda.Start(Handler) }

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

?

Slide 49

Slide 49 text

Application

Slide 50

Slide 50 text

Application Database

Slide 51

Slide 51 text

Application Database

Slide 52

Slide 52 text

Application Databases

Slide 53

Slide 53 text

Application Databases Search

Slide 54

Slide 54 text

Application Databases Search Caching

Slide 55

Slide 55 text

Application Databases Search Caching CAT GIFS

Slide 56

Slide 56 text

APPLICATION Application

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

Feb 2015 services Jan 2017 400

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

?

Slide 62

Slide 62 text

server

Slide 63

Slide 63 text

server server

Slide 64

Slide 64 text

server server server server server server

Slide 65

Slide 65 text

server server server server server server ?

Slide 66

Slide 66 text

No content

Slide 67

Slide 67 text

server server server server server server

Slide 68

Slide 68 text

server server server server server server Kubernetes

Slide 69

Slide 69 text

server server server server server kubelet

Slide 70

Slide 70 text

kubelet kubelet kubelet kubelet kubelet kubelet

Slide 71

Slide 71 text

kubelet kubelet kubelet kubelet kubelet kubelet Kubernetes Master

Slide 72

Slide 72 text

kubelet kubelet kubelet kubelet kubelet kubelet Kubernetes Master etcd

Slide 73

Slide 73 text

kubernetes

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

+ = ❤ +

Slide 76

Slide 76 text

kubernetes service service service service service service service service service service

Slide 77

Slide 77 text

Service

Slide 78

Slide 78 text

Service Service

Slide 79

Slide 79 text

Service Service Transport

Slide 80

Slide 80 text

Service Service Transport Service Service

Slide 81

Slide 81 text

Service Service Transport Service Service Client library Server library

Slide 82

Slide 82 text

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

Slide 83

Slide 83 text

Service Service Service Service

Slide 84

Slide 84 text

Service Service Service Service HTTP HTTP

Slide 85

Slide 85 text

Service Service Service Service Kubernetes
 Service

Slide 86

Slide 86 text

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

Slide 87

Slide 87 text

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

Slide 88

Slide 88 text

Service Service Service Service ?

Slide 89

Slide 89 text

Service Service Service Service linkerd

Slide 90

Slide 90 text

Service linkerd

Slide 91

Slide 91 text

Service linkerd service
 discovery

Slide 92

Slide 92 text

Service Service Service Service linkerd service
 discovery

Slide 93

Slide 93 text

Service Service Service Service linkerd

Slide 94

Slide 94 text

Service Service Service Service linkerd

Slide 95

Slide 95 text

Service Service Service Service linkerd

Slide 96

Slide 96 text

Service Service Service Service linkerd

Slide 97

Slide 97 text

Load Balancer

Slide 98

Slide 98 text

Load Balancer Edge Proxy

Slide 99

Slide 99 text

Load Balancer API
 Service Edge Proxy

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

/webhooks —-> Webhook API

Slide 102

Slide 102 text

Load Balancer Webhook
 API Edge Proxy

Slide 103

Slide 103 text

Auth
 Service Webhook
 Service Load Balancer Webhook
 API Edge Proxy

Slide 104

Slide 104 text

Auth
 Service Webhook
 Service Load Balancer Webhook
 API Database Edge Proxy

Slide 105

Slide 105 text

Database Auth
 Service Webhook
 Service Load Balancer Webhook
 API Database Edge Proxy

Slide 106

Slide 106 text

External Provider Database Auth
 Service Webhook
 Service Load Balancer Webhook
 API Database Edge Proxy

Slide 107

Slide 107 text

No content

Slide 108

Slide 108 text

CONSTRAIN
 COMPLEXITY

Slide 109

Slide 109 text

SECURITY

Slide 110

Slide 110 text

OPERATIONAL
 EASE

Slide 111

Slide 111 text

WHAT HAVE
 WE LEARNT?

Slide 112

Slide 112 text

Make services as small as possible

Slide 113

Slide 113 text

Prefer services over libraries and shared code

Slide 114

Slide 114 text

Prefer consistency in most cases

Slide 115

Slide 115 text

Isolate shared infrastructure

Slide 116

Slide 116 text

Onboarding people is hard

Slide 117

Slide 117 text

Reduce complexity

Slide 118

Slide 118 text

Monitor EVERYTHING

Slide 119

Slide 119 text

WHAT WOULD WE
 DO DIFFERENTLY?

Slide 120

Slide 120 text

No content