Principles of Microservices

1 minute read

All information presented below is not original content, this is a summary of the content that was presented by Sam Newman within the O’Reilly lecture & book:

8 Principles

  • Modelled around business domain
  • Deploy Independently
  • Culture of Automation
  • Hide implementation details
  • Decentralize all the things
  • Consumer first
  • Isolate failure
  • Highly observable


Deeper Dive into the Principles

Modelled around business domain

  • Define service boundaries that match business domain
  • Services are a collection of capabilities

Deploy Independently

  • One service per OS
  • Supporting multiple service versions
    • Co-existing service versions
    • Multiple endpoints (better than co-existing services)

Culture of Automation

  • Continuous Integration
  • Continuous Delivery
  • Automated Testing
  • API Driven Machine provisioning
  • Custom Image creation
  • Platforms (PaaS, CaaS, IaaS)
  • Declarative Environment Provisioning (e.g. Terraform)

Hide implementation details

  • Bounded Contexts
  • Easier to expose additional contexts later on than remove later on
  • Hide your backends (e.g. database, 3rd party systems, appliances)
  • Think about your protocols to communicate between APIs (e.g. protobuff, etc)
  • Be careful of client libraries (e.g. leaking behavior)

Decentralize all the things

  • Self-Service
  • Owner operator model (e.g. DevOps team)
  • Internal Open Source
  • Beware smart middleware
  • Orchestration vs Choreography

Consumer First

  • Conversations with consumers
  • Consumer driven contracts
  • Actionable standards for API creation
  • API documentation
  • Service discovery
  • Humane registry
  • Self-service

Isolate Failure

  • Microservices are not reliable by default
  • Cascading failure can hurt
  • Circuit breakers

Highly observable

  • Standard monitoring
  • Health check pages
  • Log aggregation
  • Stats aggregation
  • Downstream monitoring
  • Semantic monitoring (synthetic transactions)
  • Correlation IDs
  • Dashboards (different use cases)