Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

4Developers 2015: Do you think you're doing microservice architecture? - Marcin Grzejszczak, Łukasz Szczęsny

738 views

Published on

Marcin Grzejszczak, Łukasz Szczęsny

Language: English

Microservices are the top buzzword in IT recently. Rarely people think that it’s not just about having a separate codebase for each service. Even if you produce that fat jar from your code ­what happens now? How does your deployment pipeline look like? Having a microservice based architecure implies heavy impact on the infrastructure and its automatic provisioning. Distributed systems need to have their logs and metrics aggregated.

No more fixed ports and addresses definitions. Do you actually know what service discovery means? If you haven’t thought about this then you shouldn’t go the microservice way. We will explain what microservices are, why they are not that trivial to deal with and how to automatically set up the infrastructure around them.

Published in: Software
  • Be the first to comment

4Developers 2015: Do you think you're doing microservice architecture? - Marcin Grzejszczak, Łukasz Szczęsny

  1. 1. Drabina Ekspertów Ścisły przewodnik po aspektach miękkich – część II Enterprise makeover Making sense of agile requirements Przejrzysty i testowalny kod na Androidzie? REST w praktyce - tej dobrej i tej złej Skalowanie i integracja systemów w asynchronicznym stylu Do you think you're doing microservice architecture? CQRS dla każdego Kiedy, jak i po co migrować na NoSQL www.bottega.com.pl facebook.com/BottegaITSolutions
  2. 2. About us ŁUKASZ SZCZĘSNY Systems engineer at Co-organizer of the Warsaw Linux User Group Fan of automation and DevOps Twitter: @wybczu Blog: http://wybcz.pl Homepage: http://wybcz.pl
  3. 3. About us MARCIN GRZEJSZCZAK Software Architect at Author of "Mockito Instant", "Mockito Cookbook" books Co-author of the Groovy core’s @Builder AST Co-founder of the Warsaw Groovy User Group Co-author of "micro-infra-spring" lib Twitter: @MGrzejszczak Blog: http://toomuchcoding.blogspot.com Homepage: http://marcin.grzejszczak.pl
  4. 4. Agenda short intro to microservices how to deploy your first microservice microservice pitfalls
  5. 5. Agenda short intro to microservices how to deploy your first microservice microservice pitfalls
  6. 6. Conway’s Law Conway, Melvin E. (April 1968), How do Committees Invent?, Datamation 14 (5): 28–31, retrieved 2009-04-05 Organizations which design systems ... are constrained to produce designs which are copies of the communication structures of these organizations — M. Conway
  7. 7. A single codebase Conway’s Law in practice
  8. 8. A single codebase Conway’s Law in practice
  9. 9. Conway’s Law in practice Concept: one team two countries one codebase
  10. 10. Conway’s Law in practice Reality: two teams two countries one codebase
  11. 11. Conway’s Law in practice Effect: two different solutions solving same stuff one codebase
  12. 12. Conway’s Law - siloed teams extract from http://martinfowler.com/articles/microservices.html
  13. 13. Conway’s Law - cross functional teams extract from http://martinfowler.com/articles/microservices.html
  14. 14. Business flow AccountingBack officeFront office
  15. 15. Common problematic code flow Dto Service Impl Entity Accounting Accounting Accounting Accounting Front office Front office Front office Front office Back office Back office Back office Back office monolith many programmers big organization
  16. 16. Common problematic code flow Looks familiar? http://www.foodnetwork.com/topics/spaghetti-recipes.html
  17. 17. Code flow REST REST Autonomous Business oriented PolyglotLightweight Front office bounded context JARS Back office bounded context JARS Accounting bounded context JARS
  18. 18. Microservices vs ESB http://www.banzaj.pl/pictures/sport/boks/Haye_Walujew/haye_vs.walujew_2.jpg
  19. 19. Microservices vs ESB Enterprise Service Bus intelligent communication layer between services provides routing, transformations etc
  20. 20. Microservices vs ESB Microservices approach favors smart endpoints (services) dumb pipes (means of communication)
  21. 21. Microservices vs SOA SOA - Service Oriented Architecture - a very broad topic Typically understood as XML and SOAP based with WSDL ESB based solution Microservice may be called “more thoroughly described SOA”
  22. 22. Agenda short intro to microservices how to deploy your first microservice microservice pitfalls
  23. 23. Write code As a developer I want my microservice codebase to be small I want to be fully responsible for supporting that service I don’t want people from outside my team to push changes to my codebase
  24. 24. Write code introduce code review / working via Pull Requests dev team responsible for CD pipeline dev team receives all alerts
  25. 25. Build it As a developer I’d like all services to be built alike it’s easier to comprehend and support I’d like to have fast feedback if my code works
  26. 26. Build it
  27. 27. Build it Jenkins as a Code Jenkins master and slaves deployment Jenkins’ jobs creation one CD pipeline template to rule them all
  28. 28. Build it def project = 'quidryan/aws-sdk-test' def branchApi = new URL("https://api.github.com/repos/${project}/branches") def branches = new groovy.json.JsonSlurper().parse(branchApi.newReader()) branches.each { def branchName = it.name job { name "${project}-${branchName}".replaceAll('/','-') scm { git("git://github.com/${project}.git", branchName) } steps { maven("test -Dproject.name=${project}/${branchName}") } } }
  29. 29. Test it As a developer I don’t want to hardcode service’s IPs and ports I don’t want to set up whole environment for tests I’d like to test my application in isolation I’d like to ensure that others can talk to my service
  30. 30. Service Discovery Find your collaborator’s address and port with Zookeeper Consul Eureka Etcd ...
  31. 31. Consumer Driven Contracts HTTP REQUEST HTTP RESPONSE HTTP REQUEST HTTP RESPONSE version 1 version 2
  32. 32. Consumer Driven Contracts REQ RESP REQ RESP REQ RESP REQ RESP REQ RESP REQ RESP REQ RESP REQ RESP v1 v2 v8 v4 v2 v3
  33. 33. Consumer Driven Contracts
  34. 34. Consumer Driven Contracts
  35. 35. Consumer Driven Contracts REQ RESP REQ RESP REQ RESP v1 v8 v2 v3 STUB STUB
  36. 36. Consumer Driven Contracts REQ RESP REQ RESP REQ RESP v1 STUB STUB
  37. 37. Consumer Driven Contracts Consumer Driven Contracts: test your stub against server your consumers call your stubs
  38. 38. Deploy it As a developer I’d like my feature to be on production ASAP I’d like to have application properties in one place auditable secure
  39. 39. Deploy it
  40. 40. Deploy it Environment provisioning Puppet Chef Salt Ansible ...
  41. 41. Deploy it Application deployment Rundeck Capistrano Fabric Ansible Freight ...
  42. 42. Deploy it Application configuration Version it! Encrypt it! Spring Cloud Config Server micro-infra-spring-config
  43. 43. Monitor it As a developer I don’t want to grep my logs from different servers I’d like to have application data in one place logs metrics health status
  44. 44. Monitor it Logs Unify logging patterns! Collect logs in one place syslog, ELK stack, graylog2, Splunk, Loggly ...
  45. 45. CorrelationID FIRST SERVICE REQUEST No correlationId CorrelationId set to X CorrelationId set to X RESPONSE SECOND SERVICE REQUEST CorrelationId set to X CorrelationId set to X RESPONSE ANOTHER SERVICE REQUEST CorrelationId set to XCorrelationId set to X RESPONSE CorrelationId set to X YET ANOTHER SERVICE REQUEST CorrelationId set to XCorrelationId set to X RESPONSE
  46. 46. CorrelationID
  47. 47. Monitor it Metrics graphite + grafana / tessera collectd / munin statsd
  48. 48. Monitor it Alters nagios / zabbix cabot logstash!
  49. 49. Agenda short intro to microservices how to deploy your first microservice microservice pitfalls
  50. 50. Code reuse do not abstract everything sometimes copy paste gives you code decoupling no - copy paste is not a solution to all problems ;) do not write nanoservices - who will support it?
  51. 51. Too many technology stacks pick a right tool for the job but don’t exaggerate why would you ever want to code in Brainfuck or Whitespace? someone will support it afterwards - want to do it? ;)
  52. 52. Management issues have to invest time and effort to build foundations have to invest in infrastructure and devops feature delivery pace will decrease for some time
  53. 53. Questions?
  54. 54. Links https://github.com/microservice-hackathon Accurest - Consumer Driven Contracts implementation

×