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

How to Split Your System into Microservices

How to Split Your System into Microservices

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.

Eberhard Wolff

November 10, 2016
Tweet

More Decks by Eberhard Wolff

Other Decks in Technology

Transcript

  1. Microservices: Definition > No consistent definition > Microservices are modules

    > Independent deployment units > E.g. Docker container > Microservice owned by one team
  2. 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!
  3. 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
  4. Why Microservices? Scaling Agile Sustainable development Continuous Delivery Free choice

    of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  5. Why would you build a universal data model if that

    is neither possible nor useful??
  6. 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?
  7. Bounded Context: Challenge > Coarse-grained > Ideal: implement a functionality

    in one unit > Ideal: Independence > Might have relationships > …limiting independence
  8. 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
  9. Browsing Registration Creating Microservices User Registration Search Products by Keywords

    Browse Products by Category Checkout Payment Define Shipment Update Profile Basic customer data Preferences Recommendations Billing address Payment information All these services have data about the customer!!
  10. Bounded Context Scaling Agile Sustainable development Continuous Delivery Free choice

    of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  11. Bounded Contexts > Browsing distributed in many artifacts > Change

    to Browsing might influence all of them > …or not > BOUNDED CONTEXTS would be desirable
  12. Migrate to Bounded Context Product Customer Warehouse Product Service Customer

    Service Warehouse Service iOS Android PoS Web Browsing           Browsing
  13. 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
  14. Add Service > Might replace the old system stepwise >

    Immediate benefits > Low risk > Major reason for microservices
  15. Existing Architecture Scaling Agile Sustainable development Continuous Delivery Free choice

    of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  16. 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
  17. Browsing Registration External Systems User Registration Search Products by Keywords

    Browse Products by Category Checkout Payment Define Shipment Update Profile Browse Products by Category Payment Provider Logistic Partner
  18. Browsing Registration 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
  19. 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
  20. External Systems Scaling Agile Sustainable development Continuous Delivery Free choice

    of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  21. Browsing Registration External Systems User Registration Search Products by Keywords

    Browse Products by Category Checkout Payment Define Shipment Update Profile Browse Products by Category
  22. Browsing Registration External Systems Search Products by Keywords Browse Products

    by Category Checkout Payment Define Shipment Browse Products by Category Regis- tration Update Profile
  23. 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
  24. CQRS > Command – Query Responsibility Segregation > Commands change

    data > Query provide data > Implement in separate microservices
  25. Technical Reasons Scaling Agile Sustainable development Continuous Delivery Free choice

    of technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  26. Requirements > One microservice should implement one stream of requirements

    > Otherwise: coordinate priorities > …and therefore less independence
  27. Requirements Scaling Agile Sustainable development Continuous Delivery Free choice of

    technology Handle Legacy efficient Independent Scaling Robustness Organization Deployment Units Technology
  28. EMail [email protected] to get: Slides + Microservices Primer + Sample

    Microservices Book + Sample of Continuous Delivery Book Powered by Amazon Lambda & Microservices