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.

Microservices lessons from trenches

2,005 views

Published on

There has been a bit of hype lately around microservices and all you hear is how awesome microservices architecture is. This talk is about challenges: things you don't normally hear when developers talk about microservices

Published in: Technology
  • Be the first to comment

Microservices lessons from trenches

  1. 1. Microservices: lessons from the trenches Team Lead at ThoughtWorks Mehdi Khalili twitter: @MehdiKhalili http://www.mehdi-khalili.com/presentations/microservices-lessons- dddmel/ http://www.mehdi-khalili.com/microservices-lessons/
  2. 2. Microservices is AWESOME!!
  3. 3. Benefits of microservices • Scalability • Loose Coupling • Fault Tolerance • Scalable Development • Technical Diversification • Continuous Delivery
  4. 4. http://giphy.com/gifs/parkour-tJLFLygAbaxYk
  5. 5. http://giphy.com/gifs/fail-parkour-dZeSENj3pXT6o
  6. 6. Challenges • Fault Tolerance • Loose Coupling • Greenfield • Culture
  7. 7. Fault Tolerance
  8. 8. http://giphy.com/gifs/fail-parkour-movement- 7SqLFyxYHal6o
  9. 9. 30 services with 99.9% up-time 43m downtime per service a month 1296m downtime a month one day of downtime a month
  10. 10. The Akamai story!
  11. 11. contain the failure Netflix: assumed broken components
  12. 12. Reading • caching • data duplication! • graceful degradation
  13. 13. Actions and events • guaranteed delivery • eventual consistency
  14. 14. be proactive about failure
  15. 15. The story of recycling app pool!
  16. 16. • monitoring endpoints • synthetic monitoring be proactive about failure
  17. 17. troubleshooting
  18. 18. The story of missing param!
  19. 19. • extensive logging • correlation id • log aggregation troubleshooting Correlation Id Service From Timestamp Message 996a3975-4996 Registration::Creat e nil 02 Aug 2014 19:55:15 AEST +10:00 bbbe64ab-c84c Cart::Get nil 02 Aug 2014 19:55:15 AEST +10:00 996a3975-4996 Accounting::Creat e Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 996a3975-4996 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 NullReferenc e
  20. 20. • extensive logging • correlation id • log aggregation troubleshooting Correlation Id Service From Timestamp Message 996a3975-4996 Registration::Creat e nil 02 Aug 2014 19:55:15 AEST +10:00 bbbe64ab-c84c Cart::Get nil 02 Aug 2014 19:55:15 AEST +10:00 996a3975-4996 Accounting::Creat e Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 996a3975-4996 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 NullReferenc e
  21. 21. • extensive logging • correlation id • log aggregation troubleshooting Correlation Id Service From Timestamp Message 996a3975-4996 Registration::Creat e nil 02 Aug 2014 19:55:15 AEST +10:00 bbbe64ab-c84c Cart::Get nil 02 Aug 2014 19:55:15 AEST +10:00 996a3975-4996 Accounting::Creat e Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 996a3975-4996 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 NullReferenc e
  22. 22. Loose Coupling
  23. 23. http://giphy.com/gifs/fail-parkour-2BuleA8z0C4uY
  24. 24. you need the big picture
  25. 25. The soft-delete story!
  26. 26. you need the big picture beautiful diagrams!
  27. 27. you need the big picture Correlation Id Service From Timestamp Message 0a669422-5e44 Registration::Creat e nil 02 Aug 2014 19:55:15 AEST +10:00 bbbe64ab-c84c Accounting::Create User::AddAccount 01 Aug 2014 05:10:01 AEST +10:00 996a3975-4996 Accounting::Create Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 e30e4e37-b1e1 Avatar::Create Registration::Create 02 Aug 2014 19:55:16 AEST +10:00 NullReferenc e
  28. 28. catch contract violation at build time not run-time
  29. 29. consumer provider consumer consumer driven contracts catch contract violation at build time
  30. 30. catch contract violation at build time
  31. 31. consumer provider consumer service libraries service lib service lib catch contract violation at build time
  32. 32. Greenfield Microservices
  33. 33. http://giphy.com/gifs/zSmGb2eYIAx3y
  34. 34. you need well defined service boundaries greenfield leads to unknown boundaries
  35. 35. The nano-services story!
  36. 36. nanoservice killmenow monolith Size pain
  37. 37. always start with monolith extract the bits that would benefit from microservices
  38. 38. every greenfield project is a startup“a human institution designed to create a new product or service under conditions of extreme
  39. 39. Minimum Viable Product “that version of a new product which allows a team to collect the maximum amount of validated learning about
  40. 40. microservices is hard to implement and deploy and monitor
  41. 41. Microservices is NOT MVP
  42. 42. never start with microservices
  43. 43. The Culture
  44. 44. http://giphy.com/gifs/fail-parkour-jCi66sK0E770s
  45. 45. nothing can save you from cultural failure
  46. 46. “our release process has 43 manual and approval steps” “fixing the bug took me 5 minutes, releasing it to prod took 3 weeks!” heavy processes
  47. 47. “test automation might work for others but our system is different.” “we have 30 developers and 85 testers!” no automation
  48. 48. “we need to stop obsessing about quality and focus on getting this out soon.” no respect for quality
  49. 49. “we need a DevOps team!” “shortcut” to happiness
  50. 50. test automation deployment automation infrastructure automation DevOps culture The Culture
  51. 51. Netflix: ” you code it, you'll deploy it and you'll be on pager-duty.”
  52. 52. How do you sell microservices? DO NOT
  53. 53. takeaways
  54. 54. Fault tolerance • Contain the failure • Caching, data duplication and graceful degradation • Guaranteed delivery and eventual consistency • Be proactive about failure • Monitoring • Use extensive logging
  55. 55. Loose coupling • You need the big picture • Self documenting application • Build-time contract verification • Consumer Driven Contracts • Service Libraries
  56. 56. Avoid greenfield microservices • Start with monolith • Learn your domain model • Microservices is NOT MVP
  57. 57. takeaway • Culture, culture, culture! • Test automation • Deployment automation • Infrastructure automation • DevOps culture
  58. 58. microservices is awesome
  59. 59. benefits vs overheads Scalability Operations & monitoring Loose coupling Contract violation Fault tolerance Fault isolation Scalable development Communication overhead Lower cognitive load Losing the big picture Tech diversification Too many things to learn Continuous delivery DevOps culture
  60. 60. do it to the extent its benefits outweigh overheads and challenges
  61. 61. Next time you want to do microservices • Do you actually need it? • Do you need it now? • Are the challenges worth the benefits? • Does it fit your CULTURE?
  62. 62. Resources
  63. 63. Thank you twitter: @MehdiKhalili http://www.mehdi-khalili.com/presentations/microservices-lessons- dddmel/ http://www.mehdi-khalili.com/microservices-lessons/

×