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.

How to Split Your System into Microservices

4,614 views

Published on

Splitting a system into microservices is a challenging task. This talk shows how ideas like Bounded Context, migration scenarios and technical constraints can be used to build a microservice architecture. Held at WJAX 2016.

Published in: Software
  • Be the first to comment

How to Split Your System into Microservices

  1. 1. How to Split Your System into Microservices Eberhard Wolff @ewolff Fellow
  2. 2. http://continuous-delivery-buch.de/
  3. 3. http://microservices-buch.de/ http://microservices-book.com/
  4. 4. http://microservices-book.com/primer.html FREE!!!!
  5. 5. Microservices: Definition > No consistent definition > Microservices are modules > Independent deployment units > E.g. Docker container > Microservice owned by one team
  6. 6. Microservices: Definition Server / Container Server / Container Micro Service Micro Service
  7. 7. Microservices aim for decoupling
  8. 8. Why is the Split so Important? > Microservices implement a part of the logic > Allow isolated development of features > …and independent teams > If split is wrong, you won’t achieve goals. > …and there is just more complexity. > But there are even more goals!
  9. 9. Why Microservices? Strong Modularization Scaling Agile Sustainable development Replaceable Services Continuous Delivery Free choice of technology Handle Legacy efficient Independent Scaling Robustness Small teams develop and deploy independently Add services – not code Small Services Failure limited to single Microservice
  10. 10. Why Microservices? Scaling Agile Sustainable development Continuous Delivery Free choice of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  11. 11. There are many reasons for microservices.
  12. 12. There are many scenarios for microservices.
  13. 13. Scenario and reason influence the split.
  14. 14. Bounded Context
  15. 15. UBIQUITOUS LANGUAGE VALUE OBJECT ENTITY
  16. 16. Address VALUE OBJECT ENTITYor
  17. 17. 529 pages
  18. 18. 529 pages Part IV
  19. 19. 529 pages Part IV Chapter 14
  20. 20. A domain model is only useful in a BOUNDED CONTEXT.
  21. 21. There is no universal data model in a large system.
  22. 22. Address for a customer VALUE OBJECT ENTITYor
  23. 23. Address for calculating the drones’ routes VALUE OBJECT ENTITYor
  24. 24. Microservice = Bounded Context
  25. 25. Create some Bounded Contexts! Sir, yes, sir!
  26. 26. Why would you build a universal data model if that is neither possible nor useful??
  27. 27. Bounded Context: Challenge > Not a way to design a great architecture > …but consequence of good domain architecture > i.e. clearly separated domains will lead to separated BOUNDED CONTEXTS > …containing logic and data > How can you find BOUNDED CONTEXTS?
  28. 28. Bounded Context: Challenge > Coarse-grained > Ideal: implement a functionality in one unit > Ideal: Independence > Might have relationships > …limiting independence
  29. 29. Divide by Use Cases > Microservice should implement a use case > …ideally without calling other microservices > Divide use cases among microservices > …then decide about the BOUNDED CONTEXT
  30. 30. BrowsingRegistration Creating Microservices User Registration Search Products by Keywords Browse Products by Category Checkout Payment Define ShipmentUpdate Profile Basic customer data Preferences Recommendations Billing address Payment information All these services have data about the customer!!
  31. 31. Bounded Context Scaling Agile Sustainable development Continuous Delivery Free choice of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  32. 32. What about other scenarios??
  33. 33. Existing Architecture Product Customer Warehouse Product Service Customer Service Warehouse Service iOS Android PoS Web
  34. 34. Let’s create some Bounded Contexts!
  35. 35. Existing Architecture Product Customer Warehouse Product Service Customer Service Warehouse Service iOS Android PoS Web Browsing
  36. 36. Bounded Contexts > Browsing distributed in many artifacts > Change to Browsing might influence all of them > …or not > BOUNDED CONTEXTS would be desirable
  37. 37. Migrate to Bounded Context Product Customer Warehouse Product Service Customer Service Warehouse Service iOS Android PoS Web BrowsingBrowsing
  38. 38. Introducing Bounded Contexts > …would change the architecture completely > …might be very hard > …and risky > Is it worth it? > Is it even doable? > Might also change the organization
  39. 39. Add services Product Customer Warehouse Product Service Customer Service Warehouse Service iOS Android PoS Web
  40. 40. Add services Product Customer Warehouse Product Service Customer Service Warehouse Service iOS Android PoS Web News- letter Web
  41. 41. Add Service > Might replace the old system stepwise > Immediate benefits > Low risk > Major reason for microservices
  42. 42. Cut existing services Product Customer Warehouse Product Service Customer Service Warehouse Service iOS Android PoS Web
  43. 43. Existing Architecture Scaling Agile Sustainable development Continuous Delivery Free choice of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  44. 44. Existing Architecture > ...has an impact on the target architecture > What good is an architecture you cannot migrate into? > Might overrule everything else > Even BOUNDED CONTEXT
  45. 45. BrowsingRegistration External Systems User Registration Search Products by Keywords Browse Products by Category Checkout Payment Define ShipmentUpdate Profile Browse Products by Category Payment Provider Logistic Partner
  46. 46. BrowsingRegistration External Systems User Registration Search Products by Keywords Browse Products by Category Checkout Update Profile Browse Products by Category Payment Provider Logistic Partner Payment Shipping
  47. 47. External Systems > Limit integration for each external system to one Microservice > External system might belong to a domain > …or BOUNDED CONTEXT > ...or not > Simplifies integration > Easier to achieve robustness
  48. 48. External Systems Scaling Agile Sustainable development Continuous Delivery Free choice of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  49. 49. We expect a lot more registrations!
  50. 50. BrowsingRegistration External Systems User Registration Search Products by Keywords Browse Products by Category Checkout Payment Define ShipmentUpdate Profile Browse Products by Category
  51. 51. BrowsingRegistration External Systems Search Products by Keywords Browse Products by Category Checkout Payment Define ShipmentBrowse Products by Category Regis- tration Update Profile
  52. 52. Technical Reasons > Independent scalability is just one technical reason > There are many more > Might be OK to share database in this scenario > Might even split read and write
  53. 53. CQRS > Command – Query Responsibility Segregation > Commands change data > Query provide data > Implement in separate microservices
  54. 54. Command Queue Command Command Command Command Handler Query Handler Command Store Database Read Replica
  55. 55. Technical Reasons Scaling Agile Sustainable development Continuous Delivery Free choice of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  56. 56. Registration Requirements Browsing Checkout Marketing Sales Fulfillment Finance
  57. 57. Requirements > One microservice should implement one stream of requirements > Otherwise: coordinate priorities > …and therefore less independence
  58. 58. Registration Requirements Browsing Payment Marketing Sales FulfillmentFinance Shipping
  59. 59. Requirements Scaling Agile Sustainable development Continuous Delivery Free choice of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  60. 60. Conclusion
  61. 61. Microservices = Bounded Context
  62. 62. Split Bounded Context Migration External Systems Technical Reasons Require- ments
  63. 63. EMail slideswjax2016@ewolff.com to get: Slides + Microservices Primer + Sample Microservices Book + Sample of Continuous Delivery Book Powered by Amazon Lambda & Microservices

×