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

Microservices vs The distributed monolith

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →
carnage
October 29, 2016

Microservices vs The distributed monolith

When faced with a challenging legacy code base, tightly coupled and void of discernible structure: a big ball of mud, it is common to decide to refactor this monolith to a microservice architecture to separate concerns and split the codebase up, however without any clear boundaries you are in danger of creating a distributed big ball of mud.

You may recognise the symptoms of a distributed ball of mud: a large unfocused 'common' library shared between multiple services; performance issues as your front end makes calls to multiple back end API's to serve a single request; dependency hell on deployments as you have to release multiple code bases simultaneously and uptime issues as a single microservice going down brings down your entire application.

In this talk I'm going to cover some of the common pitfalls you might encounter when building a microservice architecture and show you how to use an event driven architecture to build truly scalable microservices.

carnage

October 29, 2016

Transcript

76 slides
  1. Key features of a monolith architecture • A monolith is

    a single app combining multiple business functions. 3
  2. Key features of a monolith architecture • A monolith is

    a single app combining multiple business functions. • A monolith is deployed and scaled as a whole. 3
  3. Key features of a monolith architecture • A monolith is

    a single app combining multiple business functions. • A monolith is deployed and scaled as a whole. • A monolith is developed on a single technology stack. 3
  4. Key features of a microservice architecture • A microservice should

    have one responsibility. • Each microservice should be independent. 4
  5. Key features of a microservice architecture • A microservice should

    have one responsibility. • Each microservice should be independent. • A microservice should have a defined API. 4
  6. Key features of a microservice architecture • A microservice should

    have one responsibility. • Each microservice should be independent. • A microservice should have a defined API. • Smart endpoints, dumb pipes 4
  7. Advantages of microservices • Improved modularisation of code • Allows

    diverse technology stacks • Independent deployment and scaling 5
  8. Advantages of microservices • Improved modularisation of code • Allows

    diverse technology stacks • Independent deployment and scaling • Smaller code base 5
  9. Disadvantages of microservices • Availability • Knowledge siloing • Testing

    of whole system is complex • Orchestration of system is harder 6
  10. What makes this so bad? • Microservices loose their independence.

    • The common library becomes huge. • The common library becomes unstable. 7
  11. What makes this so bad? • Microservices loose their independence.

    • The common library becomes huge. • The common library becomes unstable. • Discourages technological diversity. 7
  12. What is the solution? • Small focused libraries • Only

    include what is required • Composer can help you 8
  13. What is the solution? • Small focused libraries • Only

    include what is required • Composer can help you • Sometimes you just have to copy + paste 8
  14. What makes this so bad? • Live demo! • Each

    simultaneous deployment increases risk 9
  15. What makes this so bad? • Live demo! • Each

    simultaneous deployment increases risk • What about rollbacks? 9
  16. What makes this so bad? • Performance • Services must

    wait for a response • What happens when something fails? 12
  17. Projections • Turn events into read models • Need to

    be able to recover after downtime 17
  18. Projections • Turn events into read models • Need to

    be able to recover after downtime • Can be rebuilt 17
  19. Process managers • Handle business logic around events • A

    state machine • Be careful with replays 18
  20. Advantages of event driven architecture • Decouples microservices • Scales

    well • Easier to change • No distributed transactions 21

More Decks by carnage

Other Decks in Programming