Save 37% off PRO during our Black Friday Sale! »

Go and Microservices - NDC London 2018

67f4a8f2a209a38d7242829947b26ba3?s=47 mattheath
January 27, 2018

Go and Microservices - NDC London 2018

Presented at NDC London 2018

67f4a8f2a209a38d7242829947b26ba3?s=128

mattheath

January 27, 2018
Tweet

Transcript

  1. 
 Go and Microservices Matt Heath, Monzo

  2. Hi, I’m Matt @mattheath

  3. None
  4. None
  5. 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
  6. None
  7. None
  8. None
  9. None
  10. None
  11. None
  12. None
  13. None
  14. None
  15. None
  16. None
  17. Simple Effective Scalable

  18. Simplicity

  19. Lightweight Concurrency

  20. Goroutines

  21. // Blocking function call handleRequest()

  22. // Function runs concurrently go handleRequest()

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

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

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

    handleRequest main
  26. "Do not communicate by sharing memory; instead, share memory by

    communicating." - Effective Go
  27. Channels

  28. None
  29. None
  30. None
  31. None
  32. Digging
 Deeper

  33. Scheduling Goroutines

  34. Managing Memory

  35. Language Stability

  36. Putting it all together

  37. But, “microservices”?

  38. Low overheads

  39. Simple deployment

  40. None
  41. None
  42. monzo/typhon

  43. type Service func(req Request) Response

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

  45. None
  46. // Handler is your Lambda function handler func Handler(request events.APIGatewayProxyRequest)

    (events.APIGatewayProxyResponse, error) { ... } func main() { lambda.Start(Handler) }
  47. None
  48. ?

  49. Application

  50. Application Database

  51. Application Database

  52. Application Databases

  53. Application Databases Search

  54. Application Databases Search Caching

  55. Application Databases Search Caching CAT GIFS

  56. APPLICATION Application

  57. None
  58. None
  59. Feb 2015 services Jan 2017 400

  60. None
  61. ?

  62. server

  63. server server

  64. server server server server server server

  65. server server server server server server ?

  66. None
  67. server server server server server server

  68. server server server server server server Kubernetes

  69. server server server server server kubelet

  70. kubelet kubelet kubelet kubelet kubelet kubelet

  71. kubelet kubelet kubelet kubelet kubelet kubelet Kubernetes Master

  72. kubelet kubelet kubelet kubelet kubelet kubelet Kubernetes Master etcd

  73. kubernetes

  74. None
  75. + = ❤ +

  76. kubernetes service service service service service service service service service

    service
  77. Service

  78. Service Service

  79. Service Service Transport

  80. Service Service Transport Service Service

  81. Service Service Transport Service Service Client library Server library

  82. Service Discovery Load Balancing Timeouts Failure Detection Retries Rate Limiting

    Circuit Breaking Connection Pooling Context Propagation Metrics and Tracing Request Cancellation
  83. Service Service Service Service

  84. Service Service Service Service HTTP HTTP

  85. Service Service Service Service Kubernetes
 Service

  86. Service Discovery Load Balancing Timeouts Failure Detection Retries Rate Limiting

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

    Circuit Breaking Connection Pooling Context Propagation Metrics and Tracing Request Cancellation
  88. Service Service Service Service ?

  89. Service Service Service Service linkerd

  90. Service linkerd

  91. Service linkerd service
 discovery

  92. Service Service Service Service linkerd service
 discovery

  93. Service Service Service Service linkerd

  94. Service Service Service Service linkerd

  95. Service Service Service Service linkerd

  96. Service Service Service Service linkerd

  97. Load Balancer

  98. Load Balancer Edge Proxy

  99. Load Balancer API
 Service Edge Proxy

  100. None
  101. /webhooks —-> Webhook API

  102. Load Balancer Webhook
 API Edge Proxy

  103. Auth
 Service Webhook
 Service Load Balancer Webhook
 API Edge Proxy

  104. Auth
 Service Webhook
 Service Load Balancer Webhook
 API Database Edge

    Proxy
  105. Database Auth
 Service Webhook
 Service Load Balancer Webhook
 API Database

    Edge Proxy
  106. External Provider Database Auth
 Service Webhook
 Service Load Balancer Webhook


    API Database Edge Proxy
  107. None
  108. CONSTRAIN
 COMPLEXITY

  109. SECURITY

  110. OPERATIONAL
 EASE

  111. WHAT HAVE
 WE LEARNT?

  112. Make services as small as possible

  113. Prefer services over libraries and shared code

  114. Prefer consistency in most cases

  115. Isolate shared infrastructure

  116. Onboarding people is hard

  117. Reduce complexity

  118. Monitor EVERYTHING

  119. WHAT WOULD WE
 DO DIFFERENTLY?

  120. None