Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Microservices in Practice

Microservices in Practice

My talk at RubyConf Argentina 2014

Jano González

October 24, 2014
Tweet

More Decks by Jano González

Other Decks in Technology

Transcript

  1. None
  2. @janogonzalez MICROSERVICES IN PRACTICE

  3. LAST YEAR…

  4. None
  5. Leandro “Inkel” López, 2013 “El ordenador, ordena.
 La computadora, computa”

    ˝
  6. 12hrs AUDIO/min

  7. HUNDREDS OF MILLIONS users/month

  8. MANY PLATFORMS

  9. $ rails soundcloud

  10. The Mothership

  11. Pearl Jam - Do the Evolution “It’s evolution, baby!” ˝

  12. soundcloud.com iOS/Android 3rd party Public API Domain logic The Mothership

  13. None
  14. WELCOME TO THE MONOLITH Population: you

  15. CONWAY’S LAW

  16. Marvin Conway, 1968 “Organizations produce systems whose design is a

    copy of the structure of the organization”

  17. BREAKING THE
 MONOLITH ˝

  18. MICROSERVICES ARCHITECTURE

  19. JUST SOA FOR HIPSTERS?

  20. CROSS FUNCTIONAL 
 TEAMS ˝

  21. None
  22. None
  23. BOUNDED
 CONTEXTS ˝

  24. Track User Favoriting

  25. DOMAIN MODEL 
 FITS IN YOUR HEAD ˝

  26. Track Likes Count Favoriting

  27. YOU CAN USE 
 THE RIGHT TOOLS ˝

  28. FASTERS 
 TESTS ˝

  29. ENABLES 
 REPLACEABILITY ˝

  30. None
  31. CONTINUOUS 
 DEPLOYMENT ˝

  32. SOA WITHOUT VENDOR LOCK-IN?

  33. SMART COMPONENTS, 
 DUMB PIPES ˝

  34. HC SVNT DRACONES ˝

  35. YOU CAN USE 
 TOO MANY TOOLS ˝

  36. DUPLICATED 
 EFFORTS ˝

  37. AVAILABILITY VS 
 CONSISTENCY ˝

  38. CASCADING 
 FAILURES ˝

  39. None
  40. None
  41. None
  42. None
  43. TOO MANY 
 NETWORK CALLS ˝

  44. None
  45. YOU HAVE 
 NETWORK CALLS ˝

  46. L. Peter Deutsch - Ten Fallacies of Distributed Computing “The

    network is reliable”

  47. WHO CALLS WHO AGAIN?

  48. OUR MIGRATION TO MICROSERVICES

  49. SAY NO TO THE 
 BIG-BANG ˝

  50. EXTRACT WHEN 
 MODIFYING ˝

  51. Client Apps Public API Domain logic The Mothership Microservice Internal

    API (bounded context)
  52. DE-ACTIVE 
 RECORD ˝

  53. def index likes = user_likes_service.public_track_likes( @user, pagination_params) ! respond collection_for(likes)

    end
  54. USE 
 FEATURE FLAGS ˝

  55. if $feature.active?(:use_likes_service, current_user) … else … end

  56. CREATE 
 YOUR SERVICE ˝

  57. MONITOR 
 YOUR SERVICE ˝

  58. PREVENT 
 CASCADING FAILURES ˝

  59. None
  60. CIRCUIT BREAKERS ˝

  61. None
  62. X X X

  63. X X X

  64. X X

  65. USE LIFECYCLE 
 EVENTS ˝

  66. Public API Domain logic The Mothership Microservice Internal API Events

    Broker
  67. EVENTUAL 
 CONSISTENCY ˝

  68. Microservice Microservice Client b1:(p,q,r), b2:(/) (a1;b1),(a1;b2)

  69. DEFINE AUTHORITATIVE 
 SOURCES ˝

  70. DEFINE SYSTEM 
 ROLES ˝

  71. Microservice Microservice Client b1:(p,q,r), b2:(/) (a1;b1),(a1;b2)

  72. Listing system Entity System Client b1:(p,q,r), b2:(/) (a1;b1),(a1;b2)

  73. REDUCE 
 “CHATTINESS” ˝

  74. ONE SIZE 
 DOESN’T FIT ALL ˝

  75. CLIENT SPECIFIC 
 APIs ˝

  76. BFF ˝

  77. Listing system Entity System Entity System Client specific API

  78. Listing system Entity System Entity System Client specific API (a1;b1),(a1;b2)

  79. Listing system Entity System Entity System Client specific API a1:(x,y,z)

    b1:(p,q,r), b2:(/)
  80. Listing system Entity System Entity System Client specific API (a1.x,

    a1.y, b1.p)
  81. EXTRACTING 
 LIBRARIES ˝

  82. COMING SOON…

  83. DISTRIBUTED 
 TRACING ˝

  84. MORE TOLERANT 
 READERS ˝

  85. BINARY 
 PROTOCOLS? ˝

  86. CONCLUSIONS

  87. SMALL FOCUSED
 TEAMS ˝

  88. DELIVERING
 FAST ˝

  89. BEWARE OF
 LOSING THE BIG PICTURE ˝

  90. BEWARE OF
 TOO MANY STACKS ˝

  91. BEWARE OF
 DUPLICATE EFFORTS ˝

  92. AVOID
 BIG-BANG MIGRATIONS ˝

  93. EXPECT
 DISTRIBUTED FAILURE ˝

  94. MONITOR
 ALL THE SERVICES ˝

  95. MICROSERVICES WORK
 FOR US, BUT…

  96. NO SILVER BULLET ˝

  97. THANK YOU jano@soundcloud.com http://soundcloud.com/jobs

  98. (WE ARE HIRING) jano@soundcloud.com http://soundcloud.com/jobs

  99. •https://www.flickr.com/photos/rubyconfar/11231906253/in/set-72157638113568114
 •"Gilbert Hill, Andheri" by Madhav Pai - originally posted

    to Flickr as Gilbert Hill, Andheri. Licensed under Creative Commons Attribution 2.0 via Wikimedia Commons - http://commons.wikimedia.org/wiki/ File:Gilbert_Hill,_Andheri.jpg#mediaviewer/File:Gilbert_Hill,_Andheri.jpg