Microservices in Action

Book Description

Microservices in Action teaches you how to write and maintain microservice-based applications. Created with day-to-day development in mind, this informative guide immerses you in real-world use cases from design to deployment. You’ll discover how microservices enable an efficient continuous delivery pipeline, and explore examples using Kubernetes, Docker, and Google Container Engine.

Table of Contents

  1. Titlepage
  2. Copyright
  3. preface
  4. acknowledgments
  5. about this book
    1. How this book is organized: a roadmap
    2. About the code
    3. Book forum
  6. about the authors
  7. about the cover illustration
  8. Part 1: The lay of the land
    1. Chapter 1: Designing and running microservices
      1. 1.1 What is a microservice application?
        1. 1.1.1 Scaling through decomposition
        2. 1.1.2 Key principles
        3. 1.1.3 Who uses microservices?
        4. 1.1.4 Why are microservices a good choice?
      2. 1.2 What makes microservices challenging?
        1. 1.2.1 Design challenges
        2. 1.2.2 Operational challenges
      3. 1.3 Microservice development lifecycle
        1. 1.3.1 Designing microservices
        2. 1.3.2 Deploying microservices
        3. 1.3.3 Observing microservices
      4. 1.4 Responsible and operationally aware engineering culture
      5. Summary
    2. Chapter 2: Microservices at SimpleBank
      1. 2.1 What does SimpleBank do?
      2. 2.2 Are microservices the right choice?
        1. 2.2.1 Risk and inertia in financial software
        2. 2.2.2 Reducing friction and delivering sustainable value
      3. 2.3 Building a new feature
        1. 2.3.1 Identifying microservices by modeling the domain
        2. 2.3.2 Service collaboration
        3. 2.3.3 Service choreography
      4. 2.4 Exposing services to the world
      5. 2.5 Taking your feature to production
        1. 2.5.1 Quality-controlled and automated deployment
        2. 2.5.2 Resilience
        3. 2.5.3 Transparency
      6. 2.6 Scaling up microservice development
        1. 2.6.1 Technical divergence
        2. 2.6.2 Isolation
      7. 2.7 What’s next?
      8. Summary
  9. Part 2: Design
    1. Chapter 3: Architecture of a microservice application
      1. 3.1 Architecture as a whole
        1. 3.1.1 From monolith to microservices
        2. 3.1.2 The role of an architect
        3. 3.1.3 Architectural principles
        4. 3.1.4 The four tiers of a microservice application
      2. 3.2 A microservice platform
        1. 3.2.1 Mapping your runtime platform
      3. 3.3 Services
        1. 3.3.1 Capabilities
        2. 3.3.2 Aggregation and higher order services
        3. 3.3.3 Critical and noncritical paths
      4. 3.4 Communication
        1. 3.4.1 When to use synchronous messages
        2. 3.4.2 When to use asynchronous messages
        3. 3.4.3 Asynchronous communication patterns
        4. 3.4.4 Locating other services
      5. 3.5 The application boundary
        1. 3.5.1 API gateways
        2. 3.5.2 Backends for frontends
        3. 3.5.3 Consumer-driven gateways
      6. 3.6 Clients
        1. 3.6.1 Frontend monoliths
        2. 3.6.2 Micro-frontends
      7. Summary
    2. Chapter 4: Designing new features
      1. 4.1 A new feature for SimpleBank
      2. 4.2 Scoping by business capabilities
        1. 4.2.1 Capabilities and domain modeling
        2. 4.2.2 Creating investment strategies
        3. 4.2.3 Nested contexts and services
        4. 4.2.4 Challenges and limitations
      3. 4.3 Scoping by use case
        1. 4.3.1 Placing investment strategy orders
        2. 4.3.2 Actions and stores
        3. 4.3.3 Orchestration and choreography
      4. 4.4 Scoping by volatility
      5. 4.5 Technical capabilities
        1. 4.5.1 Sending notifications
        2. 4.5.2 When to use technical capabilities
      6. 4.6 Dealing with ambiguity
        1. 4.6.1 Start with coarse-grained services
        2. 4.6.2 Prepare for further decomposition
        3. 4.6.3 Retirement and migration
      7. 4.7 Service ownership in organizations
      8. Summary
    3. Chapter 5: Transactions and queries in microservices
      1. 5.1 Consistent transactions in distributed applications
        1. 5.1.1 Why can’t you use distributed transactions?
      2. 5.2 Event-based communication
        1. 5.2.1 Events and choreography
      3. 5.3 Sagas
        1. 5.3.1 Choreographed sagas
        2. 5.3.2 Orchestrated sagas
        3. 5.3.3 Interwoven sagas
        4. 5.3.4 Consistency patterns
        5. 5.3.5 Event sourcing
      4. 5.4 Queries in a distributed world
        1. 5.4.1 Storing copies of data
        2. 5.4.2 Separating queries and commands
        3. 5.4.3 CQRS challenges
        4. 5.4.4 Analytics and reporting
      5. 5.5 Further reading
      6. Summary
    4. Chapter 6: Designing reliable services
      1. 6.1 Defining reliability
      2. 6.2 What could go wrong?
        1. 6.2.1 Sources of failure
        2. 6.2.2 Cascading failures
      3. 6.3 Designing reliable communication
        1. 6.3.1 Retries
        2. 6.3.2 Fallbacks
        3. 6.3.3 Timeouts
        4. 6.3.4 Circuit breakers
        5. 6.3.5 Asynchronous communication
      4. 6.4 Maximizing service reliability
        1. 6.4.1 Load balancing and service health
        2. 6.4.2 Rate limits
        3. 6.4.3 Validating reliability and fault tolerance
      5. 6.5 Safety by default
        1. 6.5.1 Frameworks
        2. 6.5.2 Service mesh
      6. Summary
    5. Chapter 7 : Building a reusable microservice framework
      1. 7.1 A microservice chassis
      2. 7.2 What’s the purpose of a microservice chassis?
        1. 7.2.1 Reduced risk
        2. 7.2.2 Faster bootstrapping
      3. 7.3 Designing a chassis
        1. 7.3.1 Service discovery
        2. 7.3.2 Observability
        3. 7.3.3 Balancing and limiting
      4. 7.4 Exploring the feature implemented using the chassis
      5. 7.5 Wasn’t heterogeneity one of the promises of microservices?
      6. Summary
  10. Part 3: Deployment
    1. Chapter 8: Deploying microservices
      1. 8.1 Why is deployment important?
        1. 8.1.1 Stability and availability
      2. 8.2 A microservice production environment
        1. 8.2.1 Features of a microservice production environment
        2. 8.2.2 Automation and speed
      3. 8.3 Deploying a service, the quick way
        1. 8.3.1 Service startup
        2. 8.3.2 Provisioning a virtual machine
        3. 8.3.3 Run multiple instances of your service
        4. 8.3.4 Adding a load balancer
        5. 8.3.5 What have you learned?
      4. 8.4 Building service artifacts
        1. 8.4.1 What’s in an artifact?
        2. 8.4.2 Immutability
        3. 8.4.3 Types of service artifacts
        4. 8.4.4 Configuration
      5. 8.5 Service to host models
        1. 8.5.1 Single service to host
        2. 8.5.2 Multiple static services per host
        3. 8.5.3 Multiple scheduled services per host
      6. 8.6 Deploying services without downtime
        1. 8.6.1 Canaries and rolling deploys on GCE
      7. Summary
    2. Chapter 9: Deployment with containers and schedulers
      1. 9.1 Containerizing a service
        1. 9.1.1 Working with images
        2. 9.1.2 Building your image
        3. 9.1.3 Running containers
        4. 9.1.4 Storing an image
      2. 9.2 Deploying to a cluster
        1. 9.2.1 Designing and running pods
        2. 9.2.2 Load balancing
        3. 9.2.3 A quick look under the hood
        4. 9.2.4 Health checks
        5. 9.2.5 Deploying a new version
        6. 9.2.6 Rolling back
        7. 9.2.7 Connecting multiple services
      3. Summary
    3. Chapter 10: Building a delivery pipeline for microservices
      1. 10.1 Making deploys boring
        1. 10.1.1 A deployment pipeline
      2. 10.2 Building a pipeline with Jenkins
        1. 10.2.1 Configuring a build pipeline
        2. 10.2.2 Building your image
        3. 10.2.3 Running tests
        4. 10.2.4 Publishing artifacts
        5. 10.2.5 Deploying to staging
        6. 10.2.6 Staging environments
        7. 10.2.7 Deploying to production
      3. 10.3 Building reusable pipeline steps
        1. 10.3.1 Procedural versus declarative build pipelines
      4. 10.4 Techniques for low-impact deployment and feature release
        1. 10.4.1 Dark launches
        2. 10.4.2 Feature flags
      5. Summary
  11. Part 4: Observability and ownership
    1. Chapter 11: Building a monitoring system
      1. 11.1 A robust monitoring stack
        1. 11.1.1 Good monitoring is layered
        2. 11.1.2 Golden signals
        3. 11.1.3 Types of metrics
        4. 11.1.4 Recommended practices
      2. 11.2 Monitoring SimpleBank with Prometheus and Grafana
        1. 11.2.1 Setting up your metric collection infrastructure
        2. 11.2.2 Collecting infrastructure metrics — RabbitMQ
        3. 11.2.3 Instrumenting SimpleBank’s place order
        4. 11.2.4 Setting up alerts
      3. 11.3 Raising sensible and actionable alerts
        1. 11.3.1 Who needs to know when something is wrong?
        2. 11.3.2 Symptoms, not causes
      4. 11.4 Observing the whole application
      5. Summary
    2. Chapter 12 : Using logs and traces to understand behavior
      1. 12.1 Understanding behavior across services
      2. 12.2 Generating consistent, structured, human-readable logs
        1. 12.2.1 Useful information to include in log entries
        2. 12.2.2 Structure and readability
      3. 12.3 Setting up a logging infrastructure for SimpleBank
        1. 12.3.1 ELK- and Fluentd-based solution
        2. 12.3.2 Setting up your logging solution
        3. 12.3.3 Configure what logs to collect
        4. 12.3.4 Finding a needle in the haystack
        5. 12.3.5 Logging the right information
      4. 12.4 Tracing interactions between services
        1. 12.4.1 Correlating requests: traces and spans
        2. 12.4.2 Setting up tracing in your services
      5. 12.5 Visualizing traces
      6. Summary
    3. Chapter 13: Building microservice teams
      1. 13.1 Building effective teams
        1. 13.1.1 Conway’s Law
        2. 13.1.2 Principles for effective teams
      2. 13.2 Team models
        1. 13.2.1 Grouping by function
        2. 13.2.2 Grouping across functions
        3. 13.2.3 Setting team boundaries
        4. 13.2.4 Infrastructure, platform, and product
        5. 13.2.5 Who’s on-call?
        6. 13.2.6 Sharing knowledge
      3. 13.3 Recommended practices for microservice teams
        1. 13.3.1 Drivers of change in microservices
        2. 13.3.2 The role of architecture
        3. 13.3.3 Homogeneity versus technical flexibility
        4. 13.3.4 Open source model
        5. 13.3.5 Design review
        6. 13.3.6 Living documentation
        7. 13.3.7 Answering questions about your application
      4. 13.4 Further reading
      5. Summary
  12. Appendix: Installing Jenkins on Minikube
    1. Running Jenkins on Kubernetes
      1. Setting up Helm
      2. Create a namespace and a volume
      3. Installing Jenkins
      4. Configuring RBAC
      5. Testing it all works
  13. Index

Product Information

  • Title: Microservices in Action
  • Author(s): Morgan Bruce, Paulo A Pereira
  • Release date: October 2018
  • Publisher(s): Manning Publications
  • ISBN: 9781617294457