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

Building Microservice Architectures with Go - Yow! 2015

67f4a8f2a209a38d7242829947b26ba3?s=47 mattheath
December 11, 2015

Building Microservice Architectures with Go - Yow! 2015

Presented at Yow! 2015 in Melbourne, Brisbane and Sydney
http://yowconference.com.au/

67f4a8f2a209a38d7242829947b26ba3?s=128

mattheath

December 11, 2015
Tweet

More Decks by mattheath

Other Decks in Programming

Transcript

  1. Building Microservice Architectures with Go Matt Heath, Mondo #yow2015

  2. @mattheath

  3. None
  4. None
  5. 1895

  6. monoliths traditional dev

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

  17. DATABASE APPLICATION

  18. DATABASE APPLICATION

  19. DATABASE DATABASES APPLICATION

  20. DATABASE DATABASES APPLICATION SEARCH

  21. DATABASE DATABASES APPLICATION CACHE SEARCH

  22. DATABASE DATABASES APPLICATION CACHE SEARCH CAT GIFS

  23. ALL HAIL THE MONOLITH

  24. DO NOT WANT

  25. DATABASE DATABASES APPLICATION CACHE SEARCH CAT GIFS

  26. APPLICATION

  27. None
  28. None
  29. Why Microservices at Mondo?

  30. Single Responsibility Principle

  31. Bounded Context

  32. Well defined Interfaces

  33. Composability

  34. Why not start with Microservices?

  35. LOAD BALANCER

  36. LOAD BALANCER HTTP API & ROUTING LAYER

  37. TRANSPORT LOAD BALANCER HTTP API & ROUTING LAYER

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

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

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

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

    API & ROUTING LAYER DATACENTRE n
  42. None
  43. Simple Static typing Static linking

  44. Concurrency Interfaces

  45. stdlib eg. Networking

  46. Go Kit micro gRPC Kite

  47. mondough/typhon mondough/mercury

  48. LOAD BALANCER

  49. LOAD BALANCER HTTP API & ROUTING LAYER

  50. API SERVICE LOAD BALANCER HTTP API & ROUTING LAYER

  51. /webhooks —-> Webhook API

  52. WEBHOOK API LOAD BALANCER HTTP API & ROUTING LAYER

  53. WEBHOOK API AUTH SERVICE WEBHOOK SERVICE LOAD BALANCER HTTP API

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

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

    & ROUTING LAYER DATABASE DATABASE
  56. API SERVICE SERVICE A SERVICE B LOAD BALANCER HTTP API

    & ROUTING LAYER DATABASE DATABASE EXTERNAL PROVIDER
  57. Event Driven Architectures

  58. API SERVICE SERVICE A SERVICE B LOAD BALANCER HTTP API

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

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

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

    & ROUTING LAYER SERVICE C SERVICE D G E F
  62. ? ? ? LOAD BALANCER HTTP API & ROUTING LAYER

    ? ? ?? ? ? ? ? ? ? ?
  63. SERVICE

  64. Logic Handlers Storage SERVICE

  65. mercury Logic Handlers Storage SERVICE

  66. type Handler func(request) (response, error)

  67. type Transport interface { ... }

  68. type Transport interface { 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) ... }
  69. type Transport interface { 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) ... }
  70. mercury Logic Handlers Storage SERVICE

  71. mercury Logic Handlers Storage libraries SERVICE

  72. mercury Logic Handlers Storage libraries SERVICE Deployment Service Discovery Configuration

    Monitoring Authentication Authorisation Storage Circuit Breaking
  73. None
  74. None
  75. Scratch Images

  76. Statically Compiled

  77. Root CA Certs

  78. None
  79. Dealing with Complexity

  80. Testing

  81. Load Failure Degradation

  82. Monitoring

  83. Monitor your Business Logic

  84. ♥ customers

  85. In-Band vs Out of Band

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

  87. Distributed Tracing

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

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

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

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

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

  93. Context Propagation

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

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

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

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

    RECV SEND RECV SEND
  98. mondough/phosphor

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

    SEND phosphor
  100. None
  101. 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
  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. 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
  104. 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
  105. 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
  106. None
  107. 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
  108. None
  109. None
  110. None
  111. Small Simple Easy to learn

  112. Concurrency Interfaces Networking

  113. Downsides?

  114. Starting with Microservices?

  115. #yow2015 Thanks! @mattheath @getmondo

  116. 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