microservices 5 things i wish i'd known - jfall 2017

Download Microservices 5 Things I Wish I'd Known - JFall 2017

Post on 21-Jan-2018

423 views

Category:

Engineering

1 download

Embed Size (px)

TRANSCRIPT

  1. 1. VINCENT KOK | ENGINEERING MANAGER, TRELLO | @VINCENTKOK Microservices 5 things I wish Id known5 6 things I wish Id known
  2. 2. Part-time speaker For fun and zero profit About me: @vincentkok Trello Engineering Manager on the Trello team Dutch You probably heard that already ;)
  3. 3. Microservices Everybody seems to want them. Do we really know the impact of our choices? Why do we want them so badly? Microservices are messy! https://ic.kr/p/9u5pDA
  4. 4. http://geek-and-poke.com/geekandpoke/2013/7/13/foodprints
  5. 5. Grow Fat Code base grows. All the things slow down. Age Your code base will become a jurassic park introducing new tech becomes hard Ownership Who is responsible for which part and more important: who has the pager Economies of Scale The bigger the team the more they interrupt each other Monolithical issues
  6. 6. 8100 Build jobs ran last week
  7. 7. 31992 Automated tests
  8. 8. Cause of issues can be extremely hard
  9. 9. Who is having the pager? INCIDENT RESPONSE
  10. 10. Remember, were not all webscale
  11. 11. Optimise for rapid and sustainable flow of value. DAN NORD
  12. 12. Small The size will be reasonable and manageable Independent lifecycle Nothing will hold the team back. Go as fast as you can Optimise for the problem Pick solution and tech based on the problem at hand Replaceable It is easier to replace if there is a need for it The microservice promise
  13. 13. Patterns Basics Deployments Testing Security Operations https://flic.kr/p/9t2138 Decomposition
  14. 14. #1: Basics https://flic.kr/p/5E9ZF
  15. 15. Creating a call-out Watch the tutorial in the Presentation Guidelines to learn how to create call-outs on screenshots within this template.
  16. 16. MINIMAL SERVICE Health check 200 app is alive. 500 app is unhealthy, destroy the node Stateless* Run as many nodes as you need Expose a port Only access to the service
  17. 17. DEEPCHECK Deep check Quickly discover if a service fails to connect to a dependency
  18. 18. DEEPCHECK EXAMPLE { "avatar": { "details": { "avatarRepository": { "isHealthy": true }, "crowd": { "isHealthy": true }, "deadlock": { "isHealthy": true
  19. 19. CODE & BUILDS 1 repository 1 build
  20. 20. Libraries Feel free to use shared libraries but keep them loose Config Be aware of the configuration lifecycle Schemas Make sure that services are resilient to schema changes -> Postels law Testing Test in isolation. Keep them decoupled
  21. 21. Strict separation of config from code. 12 FACTOR APP
  22. 22. Redeploy Part of the service configuration. Configuration lifecycles Instant change Switches you would like to enable/disable straight away Rebuild Rebuild to apply changes
  23. 23. Treat them as cattle, not pets. BILL BAKER
  24. 24. #2: Deployments https://flic.kr/p/qP31Tf
  25. 25. Only one person There is only one person in the team that owns it Deployment smells Takes more then 15 mins Setting it up should be quick and initial deployment should quick Requires a ticket A ticket for the deployment team
  26. 26. Always deploy an empty service into production ME AND PROBABLY OTHERS
  27. 27. Developers in control Artifact What is the artifact were running. Were mostly standardising on Docker Resources What resources are requires: RDS, SQS, Dynamo etc.. Compute What EC2 instance do we want how many of those and when to scale Alarms What are the alarm thresholds for this service Ownership Who is owning the service Configuration We will be adding more icons as need arises. Speak up if in need!
  28. 28. DECLARATIVE DEPLOYMENT name: Confluence description: Confluence Cloud links: binary: type: docker name: docker.atlassian.io/confluence tag: latest healthcheck: uri: /wiki/internal/healthcheck deepcheck: uri: /wiki/internal/deepcheck semanticCheck:
  29. 29. CONFIGURATION config: environmentVariables: ASAP_AUDIENCE: "foo" ASAP_ISSUER: "foo" CONFLUENCE_VERTIGO_SMTP_HOST: "smtp.foo.com" CONFLUENCE_VERTIGO_SMTP_PORT: "587" LOG4J_EXTRA_RULES: "log4j.logger.org.hiberate=DEBU environmentOverrides: staging: config: environmentVariables: ASAP_PUBLIC_KEY_FALLBACK_REPOSITORY_URL:
  30. 30. RESOURCES resources: - type: sqs name: default attributes: MaxReceiveCount: 20 VisibilityTimeout: 60 scaling: instance: m3.xlarge min: 7
  31. 31. SIDECARS compose: httpfrontend: image: nginx tag: 1.13.6 ports: - 8080:80
  32. 32. 500 Services in production
  33. 33. #3: Testing https://flic.kr/p/hn4K4b
  34. 34. Testing microservices
  35. 35. TESTING MONOLITHS IS EASY
  36. 36. Unit Integration UI
  37. 37. TESTING Live service Test agains a real serviceMock service Test against a mock service
  38. 38. In process A local implementation of your client Out of process Use tools like WireMock and MockServer Two options
  39. 39. MOCKING SERVICES - IN PROCESS