Slide 1

Slide 1 text

Building Microservice Architectures with Go Matt Heath, Mondo

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

DO NOT WANT

Slide 25

Slide 25 text

DATABASE DATABASES APPLICATION CACHE SEARCH CAT GIFS

Slide 26

Slide 26 text

APPLICATION

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Microservices at Mondo?

Slide 30

Slide 30 text

Single Responsibility Principle

Slide 31

Slide 31 text

Bounded Context

Slide 32

Slide 32 text

Well defined Interfaces

Slide 33

Slide 33 text

Composability

Slide 34

Slide 34 text

Getting started

Slide 35

Slide 35 text

LOAD BALANCER

Slide 36

Slide 36 text

LOAD BALANCER HTTP API & ROUTING LAYER

Slide 37

Slide 37 text

TRANSPORT LOAD BALANCER HTTP API & ROUTING LAYER

Slide 38

Slide 38 text

SERVICE SERVICE SERVICE TRANSPORT LOAD BALANCER HTTP API & ROUTING LAYER

Slide 39

Slide 39 text

SERVICE SERVICE SERVICE TRANSPORT DATABASE DATABASE DATABASE LOAD BALANCER HTTP API & ROUTING LAYER

Slide 40

Slide 40 text

SERVICE SERVICE SERVICE TRANSPORT DATABASE DATABASE DATABASE LOAD BALANCER API GATEWAY

Slide 41

Slide 41 text

APPLICATION LOAD BALANCER

Slide 42

Slide 42 text

API GATEWAY APPLICATION LOAD BALANCER

Slide 43

Slide 43 text

API GATEWAY APPLICATION LOAD BALANCER

Slide 44

Slide 44 text

API GATEWAY APPLICATION LOAD BALANCER SERVICE SERVICE SERVICES

Slide 45

Slide 45 text

API GATEWAY LOAD BALANCER SERVICE SERVICE SERVICES

Slide 46

Slide 46 text

No content

Slide 47

Slide 47 text

Simple Static typing Static linking

Slide 48

Slide 48 text

Comprehensive stdlib eg. Networking

Slide 49

Slide 49 text

Concurrency

Slide 50

Slide 50 text

Interfaces

Slide 51

Slide 51 text

Go Kit micro gRPC Kite

Slide 52

Slide 52 text

mondough/typhon mondough/mercury

Slide 53

Slide 53 text

LOAD BALANCER

Slide 54

Slide 54 text

LOAD BALANCER HTTP API & ROUTING LAYER

Slide 55

Slide 55 text

API SERVICE LOAD BALANCER HTTP API & ROUTING LAYER

Slide 56

Slide 56 text

No content

Slide 57

Slide 57 text

/webhooks —-> Webhook API

Slide 58

Slide 58 text

WEBHOOK API LOAD BALANCER HTTP API & ROUTING LAYER

Slide 59

Slide 59 text

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

Slide 60

Slide 60 text

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

Slide 61

Slide 61 text

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

Slide 62

Slide 62 text

SERVICE

Slide 63

Slide 63 text

Logic Handlers Storage SERVICE

Slide 64

Slide 64 text

mercury Logic Handlers Storage SERVICE

Slide 65

Slide 65 text

mercury Logic Handlers Storage libraries SERVICE

Slide 66

Slide 66 text

func main() { }

Slide 67

Slide 67 text

func main() { }

Slide 68

Slide 68 text

func main() { }

Slide 69

Slide 69 text

func main() { srv := service.Init(service.Config{ Name: "service.account", Description: "Store bank accounts", }) srv.AddEndpoints( handler.Create, handler.Read, handler.List, ) srv.Run() }

Slide 70

Slide 70 text

func main() { srv := service.Init(service.Config{ Name: "service.account", Description: "Store bank accounts", }) srv.AddEndpoints( handler.Create, handler.Read, handler.List, ) srv.Run() }

Slide 71

Slide 71 text

func main() { srv := service.Init(service.Config{ Name: "service.account", Description: "Store bank accounts", }) srv.AddEndpoints( handler.Create, handler.Read, handler.List, ) srv.Run() }

Slide 72

Slide 72 text

type Endpoint struct { Name string Handler Handler Request interface{} Response interface{} }

Slide 73

Slide 73 text

type Endpoint struct { Name string Handler Handler Request interface{} Response interface{} }

Slide 74

Slide 74 text

type Endpoint struct { Name string Handler Handler Request interface{} Response interface{} }

Slide 75

Slide 75 text

type Handler func(request) (response, error)

Slide 76

Slide 76 text

func main() { srv := service.Init(service.Config{ Name: "service.account", Description: "boop", }) srv.AddEndpoints( handler.Create, handler.Read, handler.List, ) srv.Run() }

Slide 77

Slide 77 text

func main() { srv := service.Init(service.Config{ Name: "service.account", Description: "boop", }) srv.AddEndpoints( handler.Create, handler.Read, handler.List, ) srv.Run() }

Slide 78

Slide 78 text

type Server interface { Name() string AddEndpoints(eps ...Endpoint) RemoveEndpoints(eps ...Endpoint) Endpoint(name string) (Endpoint, bool) Endpoints() []Endpoint Start(trans transport.Transport) error Run(trans transport.Transport) Stop() Middleware() []ServerMiddleware SetMiddleware([]ServerMiddleware) AddMiddleware(ServerMiddleware) }

Slide 79

Slide 79 text

type Transport interface { Tomb() *tomb.Tomb Ready() <-chan struct{} Listen(serviceName string, inbound chan<- request) error StopListening(serviceName string) bool Respond(req request, resp response) error Send(req request, timeout time.Duration) (response, error) }

Slide 80

Slide 80 text

type Transport interface { Tomb() *tomb.Tomb Ready() <-chan struct{} Listen(serviceName string, inbound chan<- request) error StopListening(serviceName string) bool Respond(req request, resp response) error Send(req request, timeout time.Duration) (response, error) }

Slide 81

Slide 81 text

type Transport interface { Tomb() *tomb.Tomb Ready() <-chan struct{} Listen(serviceName string, inbound chan<- request) error StopListening(serviceName string) bool Respond(req request, resp response) error Send(req request, timeout time.Duration) (response, error) }

Slide 82

Slide 82 text

type Transport interface { Tomb() *tomb.Tomb Ready() <-chan struct{} Listen(serviceName string, inbound chan<- request) error StopListening(serviceName string) bool Respond(req request, resp response) error Send(req request, timeout time.Duration) (response, error) }

Slide 83

Slide 83 text

mercury Logic Handlers Storage libraries SERVICE Deployment Service Discovery Configuration Monitoring Authentication Authorisation Storage Circuit Breaking

Slide 84

Slide 84 text

No content

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

Statically Compiled Small Images Root CA Certs

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

Making our service reliable

Slide 89

Slide 89 text

Event Driven Architecture

Slide 90

Slide 90 text

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

Slide 91

Slide 91 text

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

Slide 92

Slide 92 text

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

Slide 93

Slide 93 text

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

Slide 94

Slide 94 text

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

Slide 95

Slide 95 text

? ? ? LOAD BALANCER HTTP API & ROUTING LAYER ? ? ?? ? ? ? ? ? ? ?

Slide 96

Slide 96 text

Topology Management

Slide 97

Slide 97 text

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

Slide 98

Slide 98 text

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

Slide 99

Slide 99 text

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

Slide 100

Slide 100 text

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

Slide 101

Slide 101 text

No content

Slide 102

Slide 102 text

No content

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

Fanout & Cancellation

Slide 107

Slide 107 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 108

Slide 108 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 109

Slide 109 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 110

Slide 110 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 111

Slide 111 text

WEBHOOK API WEBHOOK SERVICE WEBHOOK SERVICE WEBHOOK SERVICE

Slide 112

Slide 112 text

Context Propagation

Slide 113

Slide 113 text

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

Slide 114

Slide 114 text

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

Slide 115

Slide 115 text

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

Slide 116

Slide 116 text

No content

Slide 117

Slide 117 text

No content

Slide 118

Slide 118 text

No content

Slide 119

Slide 119 text

No content

Slide 120

Slide 120 text

Testing

Slide 121

Slide 121 text

Load Failure Degradation

Slide 122

Slide 122 text

Monitoring

Slide 123

Slide 123 text

Monitor your Business Logic

Slide 124

Slide 124 text

♥ customers

Slide 125

Slide 125 text

In-Band vs Out of Band

Slide 126

Slide 126 text

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

Slide 127

Slide 127 text

No content

Slide 128

Slide 128 text

Distributed Tracing

Slide 129

Slide 129 text

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

Slide 130

Slide 130 text

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

Slide 131

Slide 131 text

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

Slide 132

Slide 132 text

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

Slide 133

Slide 133 text

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

Slide 134

Slide 134 text

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

Slide 135

Slide 135 text

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

Slide 136

Slide 136 text

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

Slide 137

Slide 137 text

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

Slide 138

Slide 138 text

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

Slide 139

Slide 139 text

No content

Slide 140

Slide 140 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 141

Slide 141 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 142

Slide 142 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 143

Slide 143 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 144

Slide 144 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 145

Slide 145 text

No content

Slide 146

Slide 146 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 147

Slide 147 text

No content

Slide 148

Slide 148 text

No content

Slide 149

Slide 149 text

No content

Slide 150

Slide 150 text

Small Simple Easy to learn

Slide 151

Slide 151 text

Concurrency Interfaces Networking

Slide 152

Slide 152 text

Downsides?

Slide 153

Slide 153 text

Starting with Microservices?

Slide 154

Slide 154 text

Thanks! @mattheath @getmondo

Slide 155

Slide 155 text

ATM: Thomas Hawk
 Bank of Commerce: ABQ Museum Archives IBM System/360: IBM Absorbed: Saxbald Photography Orbital Ion Cannon: www.rom.ac Go Gopher: Renee French Control Room: NASA ATM Failure: George Redgrave Credits