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

Microservices & Go - GOTO Copenhagen 2016

67f4a8f2a209a38d7242829947b26ba3?s=47 mattheath
October 04, 2016

Microservices & Go - GOTO Copenhagen 2016

67f4a8f2a209a38d7242829947b26ba3?s=128

mattheath

October 04, 2016
Tweet

More Decks by mattheath

Other Decks in Technology

Transcript

  1. Microservices & Go Matt Heath, Monzo

  2. None
  3. Hi, I’m Matt @mattheath

  4. None
  5. None
  6. None
  7. monoliths traditional dev

  8. None
  9. None
  10. None
  11. None
  12. None
  13. None
  14. None
  15. None
  16. None
  17. ?

  18. Application

  19. Application Database

  20. Application Database

  21. Application Databases

  22. Application Databases Search

  23. Application Databases Search Caching

  24. Application Databases Search Caching CAT GIFS

  25. ALL HAIL THE MONOLITH

  26. None
  27. Application Databases Search Caching CAT GIFS

  28. APPLICATION Application

  29. None
  30. None
  31. Single Responsibility Principle

  32. Bounded Context

  33. Well defined Interfaces

  34. Composability

  35. None
  36. Simple

  37. Lightweight Concurrency

  38. // Blocking handleRequest()

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

  40. Go Routines

  41. Channels

  42. Static Linking

  43. None
  44. None
  45. monzo/typhon

  46. Service Service

  47. Service Service Message Bus

  48. Service Service Message Bus Request Queue

  49. Service Service Message Bus Service Service Request Queue - Service

    Discovery - Load Balancing
  50. Service Service Message Bus Service Service Pull Request Queue

  51. Service Service Message Bus Service Service

  52. 0 40 80 160 120 Feb 2015 Oct 2016

  53. Service Service Message Bus Service Service Client library Server library

  54. Service Service Service Service HTTP HTTP

  55. Service Discovery Load Balancing Timeouts and Expirations Retries Rate Limiting

    Connection Pooling Circuit Breaking Failure Detection Metrics and Tracing Interrupts Context Propagation
  56. Service Service Service Service HTTP HTTP ?

  57. Service Service Service Service HTTP HTTP linkerd

  58. Service Discovery Load Balancing Timeouts and Expirations Retries Rate Limiting

    Connection Pooling Circuit Breaking Failure Detection Metrics and Tracing Interrupts Context Propagation
  59. Load Balancer

  60. Load Balancer HTTP API & Routing Layer

  61. Load Balancer HTTP API & Routing Layer API
 Service

  62. None
  63. /webhooks —-> Webhook API

  64. Load Balancer HTTP API & Routing Layer Webhook
 API

  65. Auth
 Service Webhook
 Service Load Balancer HTTP API & Routing

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

    Layer Webhook
 API Database
  67. Database Auth
 Service Webhook
 Service Load Balancer HTTP API &

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

    API & Routing Layer Webhook
 API Database
  69. type Service func(req Request) Response

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

  71. Making our service reliable

  72. + = ❤

  73. None
  74. Webhook
 Service Webhook
 Service Webhook
 Service Load Balancer HTTP API

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

    & Routing Layer Webhook
 API
  76. Webhook
 Service Webhook
 Service Webhook
 Service Webhook
 Service Load Balancer

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

    HTTP API & Routing Layer Webhook
 API Slow or
 Errors
  78. Event Driven Architecture

  79. Service A Service B Load Balancer HTTP API & Routing

    Layer API Service
  80. API Service Service A Service B Load Balancer HTTP API

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

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

    & Routing Layer Service C Service D Service E
  83. Context Propagation

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

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

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

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

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

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

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

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

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

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

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

    SEND phosphor
  95. None
  96. 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
  97. 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
  98. 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
  99. 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
  100. 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
  101. None
  102. 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
  103. None
  104. None
  105. None
  106. None
  107. Small Simple Easy to learn

  108. Concurrency Channels

  109. Downsides?

  110. Starting with Microservices?

  111. Thanks! @mattheath @monzo

  112. ATM: Thomas Hawk
 Bank of Commerce: ABQ Museum Archives IBM

    System/360: IBM Absorbed: Saxbald Photography Go Gopher: Renee French Credits
  113. None