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.

Dismantling the Monolith: Scaling with Microservices

844 views

Published on

An intro to Microservices given at a Tech Talk at One Kings Lane

Published in: Technology
  • Be the first to comment

Dismantling the Monolith: Scaling with Microservices

  1. 1. { Dismantling the Monolith Scaling with Microservices Jenny Kim August 28, 2014
  2. 2. Schedule September 11: Refactoring Patterns by Erich Lin September 25: Cleaning with SPEED! by Lawrence and Diana October 9: Riveting Topic by YOU! Email: jennykim@onekingslane.com or abahouth@onekingslane.com Level Up Tech Talks Confluence Wiki https://confluence.newokl.com/x/DQG8 Nominate a topic and a speaker!
  3. 3. 1. Microservices in a nutshell 2. The problem with monoliths 3. The Microservice Way 4. Iterating to Microservices 5. Questions / Discussion Agenda
  4. 4. Microservices are an architectural approach to developing a single application as a suite of small services. • Each service runs in its own process • Communication via lightweight mechanisms • Service -> single bounded context • Loosely-coupled and independently deployable • Minimal central management, technology-agnostic • Polyglot persistence: each service with its own data store Microservices in a Nutshell
  5. 5. The Problem with Monoliths
  6. 6. The Problem with Monoliths
  7. 7. The Problem with Monoliths
  8. 8. The Problem with Monoliths
  9. 9. The Problem with Monoliths Domain-driven design Value Objects Concerns Entities Policy Object Decorators Data Transfer Object
  10. 10. New features and changes become increasingly difficult to: 1. Accurately Scope 2. Build and integrate in an efficient and safe manner The Problem with Monoliths
  11. 11. Testing Monoliths • Test suites grow long, slow, flaky • Quality control and root cause analysis harder as many features are implemented at the same time • Increasing reliance on manual regression testing to ensure no new bugs introduced • Longer testing and deployment cycles not amenable to CI or CD The Problem with Monoliths
  12. 12. Scaling Monoliths 1. Horizontal scaling of web and app servers 2. Database replication or sharding The Problem with Monoliths
  13. 13. The Problem with Monoliths Monolithic Apps require scaling the entire monolith What if one component requires much more resources than the others?
  14. 14. The Problem with Monoliths Gilt • Members-only flash sales site • Luxury brands at up to 70% off • Sales launch at noon EST • Members can reserve physical units for a limited time, by adding to cart
  15. 15. The Problem with Monoliths
  16. 16. The Problem with Monoliths
  17. 17. April 8, 2009: “The Louboutin Incident” The Problem with Monoliths
  18. 18. The Problem with Monoliths Sales Volume by $/hour at peak by day
  19. 19. The Problem with Monoliths
  20. 20. The Problem with Monoliths Gilt Transaction Sequence Modules
  21. 21. The Microservice Way
  22. 22. Bounded Contexts Autonomous components, with their own domain models and specific responsibilities. The Monolithic Way
  23. 23. The Monolithic Way Keep It Small. Keep It Simple. Services should be small enough for any developer to easily understand all aspects of the service, and where rewriting would be straightforward.
  24. 24. The Monolithic Way Communication Not Coupling Interaction with each other through interfaces (APIs), or via messaging broker. (And no, sharing data models with ActiveResource does not count.) OR
  25. 25. The Monolithic Way Decentralized Governance Flexibility and freedom to write and build each service in any language or technology.
  26. 26. What’s the difference between Microservices and SOA? The Microservice Way Microservices == SOA for Hipsters?
  27. 27. Independent Deployability and Scalability 1. Services must be deployed on-demand, independently, preferably automatically. (added perk: zero-downtime?) 2. Services can be distributed and scaled independently, as individual resource-needs dictate. The Microservice Way
  28. 28. Design for Failure 1. Distributed systems mean designing for fault tolerance. 2. Any service could fail at any time! (server failure, network unavailability, etc) 3. Detect failures quickly and if possible, automatically restore services that go offline. 4. Real-time monitoring, insight and proactive alerts on network traffic, monitoring of service request latency. The Microservice Way
  29. 29. Decentralized Data Management The Microservice Way
  30. 30. Iterating to Microservices
  31. 31. Soundcloud Iterating to Microservices Source “Building Products at SoundCloud —Part I: Dealing with the Monolith” https://developers.soundcloud.com/blog/building-products-at-soundcloud-part- 1-dealing-with-the-monolith
  32. 32. Rule 1: Stop the Monolithic Growth Iterating to Microservices
  33. 33. Rule 2: Every existing feature that requires significant rework will be removed and rewritten as a micro service. Iterating to Microservices
  34. 34. Rule 3: Microservices should only communicate via well-defined interfaces. Iterating to Microservices
  35. 35. Rule 4: Use coarse-grained, loosely- coupled services. Iterating to Microservices
  36. 36. Iterating to Microservices
  37. 37. Iterating to Microservices
  38. 38. Iterating to Microservices
  39. 39. Iterating to Microservices
  40. 40. How you implement microservices depends on your context! Balancing and rebalancing is the key. Iterating to Microservices
  41. 41. 1. Monolithic Problems: complexity! coupling! testability! scalability! 2. Microservices: small services, independent deployments, decentralized governance 3. Iterate to success! Summary
  42. 42. Questions / Discussion

×