Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building a Bank with Go - Bristech 2015

67f4a8f2a209a38d7242829947b26ba3?s=47 mattheath
October 15, 2015

Building a Bank with Go - Bristech 2015

Traditionally applications have been built as monoliths; single applications which become larger and more complex over time, which limit our ability to react to change. An example of this is the banking industry where mergers and acquisitions between banks have lead to a patchwork of different systems & technologies that cost billions of dollars per year to maintain. As a result, the pace of innovation in the banking industry has slowed to a crawl.

At Mondo we're building a new kind of bank, a smart bank that belongs in the 21st century. This talk will cover how we’re developing new core banking systems from scratch backed by a microservice platform written in Go, running across multiple data centres using open source frameworks and tools including Docker and Mesos. We'll look at why Go is perfectly suited to this, our architectural decisions, common pitfalls to avoid, and how microservice architectures can vastly increase both the velocity of development teams and the scalability and fault tolerance of our systems.

67f4a8f2a209a38d7242829947b26ba3?s=128

mattheath

October 15, 2015
Tweet

Transcript

  1. Building a Bank with Go Matt Heath, Mondo #bristech 2015

  2. @mattheath

  3. None
  4. None
  5. 1895

  6. monoliths traditional dev

  7. None
  8. None
  9. None
  10. Time for a new kind of bank?

  11. None
  12. None
  13. None
  14. None
  15. None
  16. You're doing quite well

  17. None
  18. None
  19. None
  20. the majestik møøse

  21. the majestik moose

  22. sıkısınca

  23. sikisinca

  24. None
  25. None
  26. DATABASE APPLICATION

  27. DATABASE APPLICATION

  28. DATABASE DATABASES APPLICATION

  29. DATABASE DATABASES APPLICATION SEARCH

  30. DATABASE DATABASES APPLICATION CACHE SEARCH

  31. DATABASE DATABASES APPLICATION CACHE SEARCH CAT GIFS

  32. ALL HAIL THE MONOLITH

  33. DO NOT WANT

  34. DATABASE DATABASES MONOLITH CACHE SEARCH CAT GIFS

  35. MONOLITH

  36. None
  37. None
  38. Single Responsibility Principle

  39. Bounded Context

  40. Well defined Interfaces

  41. Composability

  42. LOAD BALANCER

  43. LOAD BALANCER HTTP API & ROUTING LAYER

  44. SERVICE TRANSPORT LOAD BALANCER HTTP API & ROUTING LAYER

  45. SERVICE SERVICE SERVICE TRANSPORT LOAD BALANCER HTTP API & ROUTING

    LAYER
  46. SERVICE SERVICE SERVICE TRANSPORT DATABASE DATABASE DATABASE LOAD BALANCER HTTP

    API & ROUTING LAYER
  47. SERVICE SERVICE SERVICE TRANSPORT DATABASE DATABASE DATABASE LOAD BALANCER DATACENTRE

    n HTTP API & ROUTING LAYER
  48. SERVICE SERVICE SERVICE TRANSPORT DATABASE DATABASE DATABASE LOAD BALANCER HTTP

    API & ROUTING LAYER DATACENTRE n
  49. None
  50. Concurrency Networking Deployability

  51. gRPC Go Kit Kite go-micro

  52. mondough/typhon mondough/mercury

  53. LOAD BALANCER

  54. LOAD BALANCER HTTP API & ROUTING LAYER

  55. SOME
 API LOAD BALANCER HTTP API & ROUTING LAYER

  56. SOME
 API SERVICE ONE SERVICE TWO LOAD BALANCER HTTP API

    & ROUTING LAYER
  57. SOME
 API SERVICE ONE SERVICE TWO LOAD BALANCER HTTP API

    & ROUTING LAYER DATABASE
  58. SOME
 API SERVICE ONE SERVICE TWO LOAD BALANCER HTTP API

    & ROUTING LAYER DATABASE DATABASE
  59. SOME
 API SERVICE ONE SERVICE TWO LOAD BALANCER HTTP API

    & ROUTING LAYER DATABASE DATABASE EXTERNAL PROVIDER
  60. ? ? ? LOAD BALANCER HTTP API & ROUTING LAYER

    ? ? ?? ? ? ? ? ? ? ?
  61. SERVICE

  62. Logic Handlers Storage SERVICE

  63. mercury Logic Handlers Storage SERVICE

  64. mercury Logic Handlers Storage libraries SERVICE

  65. func main() { }

  66. func main() { srv := service.Init(service.Config{ Name: "service.account", Description: "Store

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

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

    bank accounts", }) srv.AddEndpoints( handler.Create, handler.Read, handler.List, ) srv.Run() }
  69. type Handler func(request) (response, error)

  70. type Endpoint struct { Name string Handler Handler Request interface{}

    Response interface{} }
  71. func main() { srv := service.Init(service.Config{ Name: "service.account", Description: "boop",

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

    }) srv.AddEndpoints( handler.Create, handler.Read, handler.List, ) srv.Run() }
  73. 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) }
  74. 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) }
  75. 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) }
  76. api api api.customer api.customer service.customer service.customer

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

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

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

  80. package context type Context interface { Deadline() (deadline time.Time, ok

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

    bool) Done() <-chan struct{} Err() error Value(key interface{}) interface{} }
  82. api api api.customer api.customer service.customer service.customer

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

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

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

  86. mercury Logic Handler Storage libraries SERVICE

  87. mercury Logic Handler Storage libraries SERVICE PROVISIONING SERVICE DISCOVERY CONFIGURATION

    MONITORING AUTHENTICATION AUTHORISATION A/B TESTING STORAGE MESSAGING
  88. None
  89. Scratch Static SSL

  90. None
  91. Dealing with Complexity

  92. TESTING

  93. LOAD FAILURE DEGRADATION

  94. MONITORING

  95. type Checker func() (err error, data map[string]string)

  96. MONITOR YOUR BUSINESS LOGIC

  97. None
  98. DISTRIBUTED
 TRACING

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

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

    RECV SEND RECV SEND
  101. mondough/phosphor

  102. PhosphorD Service A Trace Library goroutine chan UDP Service B

    Trace Library goroutine chan UDP PHOSPHOR HOST INSTANCES PUBLISH DASHBOARDS AGGREGATION PERSISTANCE NSQ
  103. None
  104. None
  105. None
  106. None
  107. Small Simple Easy to learn

  108. Concurrency Networking Interfaces

  109. Downsides?

  110. Starting with microservices?

  111. Thanks! @getmondo @mattheath Join our alpha at getmondo.co.uk!

  112. ATM: Thomas Hawk
 IBM System/360: IBM Absorbed: Saxbald Photography Orbital

    Ion Cannon: www.rom.ac Go Gophers: Renee French Control Room: NASA ATM Failure: George Redgrave ATM: Thomas Hawk
 IBM System/360: IBM Absorbed: Saxbald Photography Orbital Ion Cannon: www.rom.ac Go Gophers: Renee French Control Room: NASA ATM Failure: George Redgrave Credits