Saturday, 30 January 2016

Principles of Microservices



Model Around Business Concept
  • More stable than interface structured around technical concepts.
  • Reflect change in business process easily.
  • Use bounded contexts to define potential domain bounderies.
Culture of Automation
  • Keep the added complexity of microservices under control.
  • Automated testing is essential.
  • Deploy the same way everywhere.
  • Use environment definitions.
  • Creation of fully automated immutable servers.
Hide Internal Implementation Details
  • Technology agnostic API such as REST.
  • Services hide and don't share their respective database.
  • Use data pumps or event data pumps to consolidate data for reports.
Independently Deployable
  • Coexist versionned endpoints: consumers decide when they update themselves.
  • One service per host: eliminate impacts on unrelated service.
  • Blue/green or canary release: reduce risk of wrong release.
  • Consumer-driven contracts: catch breaking changes before they happen.
Isolate Failure
  • Don't treat remote call like local calls.
  • Plan for failure: Expect that failure will occur anywhere and everywhere.
  • Use appropriate timeouts.
  • Bulkheads and circuit breakers: limit the fallout of a failing components.
  • Sacrifice availability or consistency when network partition is unavailable.
Highly Observable
  • Logs aggregation with drill down capabilities.
  • Stats aggregation with drill down capabilities.
  • Use correlation IDS to trace calls through the system.
  • Use semantic monitoring with syntetic transactions injection to simulate real-user behaviors.
Decentralize All The Things
Organization: delegate decision making and control to the team.
  • Self-service: develop, test and deploy without relying on other teams.
  • Team own their services and are the domain expert.
  • Align team to the organization. (Conway's law).
  • Internal open source: Use open-source method to run projects.
  • Shared governance: people from each service team collectively share responsability for the technical vision of the overall system. 
Architecture: keep associated logic and data within service boundaries.
  • Avoid enterprise service bus, orchestration systems, dumb services.
  • Prefer choreography over orchestration.
  • Prefer dumb middleware with smart endpoints. 

Reference: Newman, Sam. Building Microservice. O'Reilly, 2015.

No comments:

Post a Comment