O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.

Geecon Prague 2016 - Thirty months of microservices

Slide deck for my talk on microservices, domain driven design and continuous delivery at the GeeCon 2016 conference in Prague, October 2016.

  • Entre para ver os comentários

  • Seja a primeira pessoa a gostar disto

Geecon Prague 2016 - Thirty months of microservices

  1. 1. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 1 @aahoogendoorn | www.ditisagile.nl Thirty months of microservices Stairway to heaven or highway to hell? Sander Hoogendoorn ditisagile.nl
  2. 2. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 2 Sander Hoogendoorn Me Dad, software architect, agile coach, programmer, trainer, speaker, writer Books, articles, conferences, courses Work Owner ditisagile.nl Former CTO insurance company Former global agile thoughtleader Capgemini Web www.sanderhoogendoorn.com aahoogendoorn aahoogendoorn sander@ditisagile.nl
  3. 3. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 3
  4. 4. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 4 As a project manager I would like to demo untested code so I embarrass myself
  5. 5. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 5 @aahoogendoorn | www.ditisagile.nl Monoliths Hard to deliver, even harder to test and impossible to maintain
  6. 6. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 6 Who has a system that is too big and that really should be broken up?
  7. 7. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 8
  8. 8. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 9
  9. 9. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 10
  10. 10. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 11 Dependencies will kill you A typical systems landscape
  11. 11. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 18 @aahoogendoorn | www.ditisagile.nl Microservices Beyond the hype?
  12. 12. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 19 Microservices Beyond the hype?
  13. 13. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 20 Gartner hype cycle
  14. 14. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 21 @aahoogendoorn | www.ditisagile.nl Microservices The clear benefits
  15. 15. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 22 But first … a definition
  16. 16. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 23 In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. Martin Fowler
  17. 17. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 24 In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. Martin Fowler
  18. 18. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 32 Products not projects Scalable Decentralized governance Replaceable parts High performance Technology independent Polyglot persistence Easy to build Easy to test Easier deployment than monoliths Microservices Promises
  19. 19. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 33 What is a microservice exactly? How small is a microservice? Requirements in a microservice world Components or services Who owns a microservice? What technologies do you use? What protocols do you apply? How to define messages How to test microservices How to coordinate when business services run across components? How to build deployment pipelines? How does integration really work? Containers anyone? Microservices But…
  20. 20. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 34 Opinions, opinions, opinions
  21. 21. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 35 Oh and by the way… Doing microservices means that you are building a distributed system
  22. 22. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 36 @aahoogendoorn | www.ditisagile.nl Are microservices a stairway to heaven?
  23. 23. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 37 @aahoogendoorn | www.ditisagile.nl Or are they a highway to hell?
  24. 24. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 38 @aahoogendoorn | www.ditisagile.nl From the trenches Microservices in real life
  25. 25. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 39 Where do we come from?
  26. 26. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 40 Where do we come from?
  27. 27. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 41 Where do we come from?
  28. 28. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 42 Outsourcing didn’t work
  29. 29. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 43 Where are we going to?
  30. 30. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 48 For the things we have to learn before we can do them, we learn by doing themAristotle
  31. 31. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 50 @aahoogendoorn | www.ditisagile.nl So what did we learn?
  32. 32. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 51 Microservices require an evolutionary software architecture
  33. 33. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 52 @aahoogendoorn | www.ditisagile.nl Start with some guiding principles
  34. 34. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 55 Client thinks in business processes, so we implement business processes We move away from the mainframe, to a new systems landscape, consisting of micro-applications and micro- components Requirements and documentation are modeled rather than written Applications implement a single elementary business process Applications and components all have their own bounded context Applications do not have storage, and only talk to other applications and components Components have their own storage (database), and only talk to other components Communication between applications and components uses a simple open protocol – JSON on REST Avoid transactional behavior as much as possible Some guiding principles
  35. 35. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 56 Client thinks in business processes, so we implement business processes We move away from the mainframe, to a new systems landscape, consisting of micro-applications and micro- components Requirements and documentation are modeled rather than written Applications implement a single elementary business process Applications and components all have their own bounded context Applications do not have storage, and only talk to other applications and components Components have their own storage (database), and only talk to other components Communication between applications and components uses a simple open protocol – JSON on REST Avoid transactions as much as possible Some guiding principles
  36. 36. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 59
  37. 37. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 60
  38. 38. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 68 @aahoogendoorn | www.ditisagile.nl Designing microservices Modular design and bounded contexts
  39. 39. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 69 Doing big up-front design is dumb, doing no design up-front is even dumberDave Thomas
  40. 40. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 70 Bounded contexts
  41. 41. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 72 Single responsibility principle Group together things that change together Separate things that change for different reason
  42. 42. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 74 Bounded context When you model larger domains, it becomes progressively harder to create this single unified model. Instead of creating a single unified model, you create several, all valid within their bounded context
  43. 43. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 75 The single unified domain model Or more often the humongous data model
  44. 44. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 76 Bounded contexts
  45. 45. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 77
  46. 46. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 82 @aahoogendoorn | www.ditisagile.nl RESTfulness is not as easy as it seems
  47. 47. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 83 A small quiz Guess the HTTP status codes… Get localhost:8080/countries Get localhost:8080/countries/42 localhost:8080/countries/GRC localhost:8080/countries/isocode/GRC localhost:8080/countries?isocode=“GRC” Post or put? localhost:8080/countries localhost:8080/countries/38
  48. 48. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 89 HTTP return codes cheat sheet 1**. Hold on 2**. Here you go 3**. Go away 4**. You fucked up 5**. I fucked up
  49. 49. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 90 Be conservative in what you send, be liberal in what you accept Postel’s Law
  50. 50. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 92 @aahoogendoorn | www.ditisagile.nl Testing microservices
  51. 51. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 93 Fail fast, fail often, fail forward
  52. 52. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 94 A (typical) service development lifecycle
  53. 53. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 95 What to test?
  54. 54. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 96 Even though you might have really brilliant testers…
  55. 55. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 97 … please automate all your tests
  56. 56. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 98 User acceptance testing Minimize to the max
  57. 57. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 101 @aahoogendoorn | www.ditisagile.nl Deploying microservices Continuous integration and build pipelines
  58. 58. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 105 Microservices. Building a deployment pipeline Code DeveloperTest Test AcceptanceTest Acceptance Live Code DeveloperTest Test AcceptanceTest Acceptance Live Code DeveloperTest Test AcceptanceTest Acceptance Live Code DeveloperTest Test AcceptanceTest Acceptance Live
  59. 59. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 106 Microservices. Pipeline hell? Codev.2 DeveloperTestv.2 Testv.2 AcceptanceTestv.2 Acceptancev.2 Code DeveloperTest Test AcceptanceTest Acceptance Live Testv.2 AcceptanceTestv.2 Acceptancev.2 Livev.2 DeveloperTest Test AcceptanceTest Acceptance Live Codev.3 DeveloperTestv.3 Live Codev.2
  60. 60. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 107 No one tool to rule them all We tried Jenkins, Bamboo, Team City, GoCD and then Jenkins again…
  61. 61. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 108 @aahoogendoorn | www.ditisagile.nl Some tooling we use IntelliJ SonarQube Jenkins Git & Gitlab Infrastructure as code
  62. 62. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 109
  63. 63. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 110
  64. 64. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 111
  65. 65. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 112
  66. 66. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 113
  67. 67. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 114
  68. 68. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 115
  69. 69. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 116
  70. 70. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 117
  71. 71. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 118
  72. 72. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 119
  73. 73. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 120
  74. 74. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 121
  75. 75. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 122
  76. 76. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 123 DevOps is not easy It feels like showing up at the wrong re-enactment
  77. 77. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 124 Infrastructure as code (often Groovy) And guess what … we know how to do that
  78. 78. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 125
  79. 79. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 126
  80. 80. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 127
  81. 81. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 140 @aahoogendoorn | www.ditisagile.nl In retrospective Some final thoughts
  82. 82. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 141 Microservices are not for everyone (yet) How do we benefit from implementing microservices?
  83. 83. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 142 Will it work?
  84. 84. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 143 The hockey stick model
  85. 85. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 146 @aahoogendoorn | www.ditisagile.nl Allow your teams to learn continuously…
  86. 86. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 147 @aahoogendoorn | www.ditisagile.nl And never forget to have fun
  87. 87. @aahoogendoorn | www.ditisagile.nlThirty months of microservices. Stairway to heaven or highway to hell? 148 @aahoogendoorn | www.ditisagile.nl References and questions www.sanderhoogendoorn.com www.ditisagile.nl aahoogendoorn aahoogendoorn sander@ditisagile.nl

×