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

Architectures for Continuous Delivery

Architectures for Continuous Delivery

Continuous delivery helps to achieve typical goals of a good software architecture - but continuous delivery must also be support in the architecture. This presentation show the relation between architecture and continuous delivery - and how this makes software development more successful

Eberhard Wolff

May 17, 2018
Tweet

More Decks by Eberhard Wolff

Other Decks in Technology

Transcript

  1. Lower Risk • Each deployment contains less changes • Lower

    risk of a bug • Easier to fall back • …or add other safeguards Quarterly Release Daily Release
  2. Continuous Delivery A Proven Success! • 2017 State of DevOps

    Reports by DORA based on 27.000 surveys • Failure rate multiple deploys a day: 0-15% • Failure rate once a week to once a month: 31-45% https://puppet.com/resources/whitepaper/state-of-devops-report
  3. Higher Reliability • Automated deployment and tests • …easy to

    reproduce • ...faster • ...executed frequently Commit Stage Automated Acceptance Testing Automated Capacity Testing Manual Explorative Testing Release ❌ ✅ ❌ ✅ ❌ ✅
  4. Principles Agile Manifesto Our highest priority is to satisfy the

    customer through early and continuous delivery of valuable software.
  5. Continuous Delivery: Why Do I Even Care? • Faster Feedback

    • Lower Risk • Higher Reliability • Value to the customer
  6. Continuous Delivery FTW! • Usually changeability = well-structured software •

    What is easier to change? • …well-structured software? • …or software with extensive automated tests? ❌ ✅
  7. Continuous Delivery FTW! • Usually changeability = well-structured software •

    What would you rather change? • …well-structured software • …or software that goes in production reliably and fully automated?
  8. Customer Scenario • Quarterly releases • 10 weeks of testing

    • Release two days over the weekend • Goal: Several deployments a day Development Testing Release Testing + Release + Development Time
  9. Customer Scenario: Automation • Development faster – smaller batches •

    Assumption: Test automation = 100x speedup for test • 4h Tests Development Testing Release Testing
  10. Customer Scenario: Automation • 2h Deployment + 4h tests =

    6 hours = 1 deployment per day Need another threefold improvement Release Testing
  11. Architecture • What are the modules? • Make modules independently

    deployable! • …continuous delivery pipelines are much simpler. • …deployment is less risky. • Microservices!
  12. Creator: INNOQ | h/p://isa-principles.org >Reuse “Module” ideas: >High cohesion, low

    coupling, >SeparaCon of concerns, >Single Responsibility … 1 | Modules
  13. Creator: INNOQ | h/p://isa-principles.org >Microservices can only be deployed independently

    … >... if pipelines are independent 6 | Independent ConBnuous Delivery Pipeline
  14. Interfaces • Microservice have interfaces to other microservices • Changing

    an interface means two microservices need to be changed
  15. Invoice Uses Interface Version 42 Order Provides Interface Version 42

    Invoice V43 Order V43 Deployment of Order and Invoice
  16. Invoice Uses Interface version 42 Order Provides Interface version 42

    Invoice V43 Order V43 Deployment of order and invoice Dependent Deployment Pipelines!
  17. Invoice Uses V42 Order Provides V42 Invoice Uses V42 Order

    Provides V43 Backwards Compatible Invoice Uses V43 Order Provides V43 Deployment of Order Deployment of Invoice
  18. Invoice Uses V42 Order Provides V42 Invoice Uses V42 Order

    Provides V43 & V42 Invoice Uses V43 Order Provides V43 & V42 Deployment of Order Deployment of Invoice Invoice Uses V43 Order Provides V43 Deployment of Order
  19. But… • …this is hard! • …but otherwise: no independent

    deployment • Worst case: everything must be deployed in one step. • Deployment monolith
  20. Tests • It is not enough to separate microservices •

    For independent deployment pipelines, tests must be separated, too.
  21. Stubs • Does the calling module (invoice) work as expected?

    • Use stubs to replace called module
  22. Consumer-driven Contract Test • Does the called module (order) work

    as expected? • Use consumer-driven contract test to replace calling module • Easy to test changes to interfaces
  23. Consumer-driven Contract Test • A pattern: Invoice provides a test

    for Order • …might be written with any testing framework • Pact test can be written in one programming language • …recorded as JSON • …and can be executed with a different language • Technology independence • https://github.com/mvitz/pact-example
  24. Database Changes Are Hard • Schema changes • Converting existing

    data • Potential lots of data • Takes long • Might fail • Hard or even impossible to rollback
  25. Dealing with Database Changes • Backwards compatible changes only •

    Support previous version schema • Default value for new columns • Incompatible changes after software changes • Remove column only if not used any more • …
  26. Keep Database Schema Stable • Change database before microservices use

    it • Change database seldom • E.g. once a week • i.e. schema changes not part of deployment • No rollback necessary
  27. Invoice Uses Less Columns Invoice Invoice Uses New Columns Database

    Schema V24 Database Schema V23 Database Schema V24 Weekly Database Deployment Invoice Uses Database Schema V23 Database Schema V23 Deployment of Invoice Deployment of Invoice
  28. Invoice Order • New features need changes to both microservices.

    • Deployment fully decoupled • …but that is useless • …as both will be deployed anyways • Also: Order too complex
  29. Bounded Context • Domain model is only valid for one

    context • There is no universal data model! • See all failed SOA attempts
  30. Order Shipping address Tracking # Items Item Categories Priority shipping

    Customs # Account # ... Credit card # Order # Customs Order Recommen- dations Order Tracking Order Shipping address Tracking # Item Categories Priority shipping Customs # Invoice Order Account # Credit card #
  31. Bounded Context • Decoupled domain architecture • Features need changes

    to one bounded context only. • Implement bounded contexts as microservices • …to gain independent microservices • …and really independent deployment.
  32. Architecture for Continuous Delivery • Separately deployable modules • Aka

    microservices • Decouple deployments for interface changes! • Decouple tests! • Decouple database changes! • Use bounded context for decoupled domain architecture!
  33. Architecture and Continuous Delivery • Architecture and continuous delivery •

    …two battles at the same time? • Split apart a microservice! • Easy to build a continuous delivery pipeline for a new microservice! • So: Synergy when introducing microservices and continuous delivery at the same time.