Microservices in Action
Morgan Bruce, Paulo A. Pereira
  • October 2018
  • ISBN 9781617294457
  • 392 pages
  • printed in black & white

The one [and only] book on implementing microservices with a real-world, cover-to-cover example you can relate to.

Christian Bach, Swiss Re

Microservices in Action is a practical book about building and deploying microservice-based applications. Written for developers and architects with a solid grasp of service-oriented development, it tackles the challenge of putting microservices into production.

About the Technology

Invest your time in designing great applications, improving infrastructure, and making the most out of your dev teams. Microservices are easier to write, scale, and maintain than traditional enterprise applications because they’re built as a system of independent components. Master a few important new patterns and processes, and you’ll be ready to develop, deploy, and run production-quality microservices.

About the book

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 detailed table of contents

Part 1: The lay of the land

1 Designing and running microservices

1.1 What is a microservice application?

1.1.1 Scaling through decomposition

1.1.2 Key principles

1.1.3 Who uses microservices?

1.1.4 Why are microservices a good choice?

1.2 What makes microservices challenging?

1.2.1 Design challenges

1.2.2 Operational challenges

1.3 Microservice development lifecycle

1.3.1 Designing microservices

1.3.2 Deploying microservices

1.3.3 Observing microservices

1.4 Responsible and operationally aware engineering culture


2 Microservices at SimpleBank

2.1 What does SimpleBank do?

2.2 Are microservices the right choice?

2.2.1 Risk and inertia in financial software

2.2.2 Reducing friction and delivering sustainable value

2.3 Building a new feature

2.3.1 Identifying microservices by modeling the domain

2.3.2 Service collaboration

2.3.3 Service choreography

2.4 Exposing services to the world

2.5 Taking your feature to production

2.5.1 Quality-controlled and automated deployment

2.5.2 Resilience

2.5.3 Transparency

2.6 Scaling up microservice development

2.6.1 Technical divergence

2.6.2 Isolation

2.7 What’s next?


Part 2: Design

3 Architecture of a microservice application

3.1 Architecture as a whole

3.1.1 From monolith to microservices

3.1.2 The role of an architect

3.1.3 Architectural principles

3.1.4 The four tiers of a microservice application

3.2 A microservice platform

3.2.1 Mapping your runtime platform

3.3 Services

3.3.1 Capabilities

3.3.2 Aggregation and higher order services

3.3.3 Critical and noncritical paths

3.4 Communication

3.4.1 When to use synchronous messages

3.4.2 When to use asynchronous messages

3.4.3 Asynchronous communication patterns

3.4.4 Locating other services

3.5 The application boundary

3.5.1 API gateways

3.5.2 Backends for frontends

3.5.3 Consumer-driven gateways

3.6 Clients

3.6.1 Frontend monoliths

3.6.2 Micro-frontends


4 Designing new features

4.1 A new feature for SimpleBank

4.2 Scoping by business capabilities

4.2.1 Capabilities and domain modeling

4.2.2 Creating investment strategies

4.2.3 Nested contexts and services

4.2.4 Challenges and limitations

4.3 Scoping by use case

4.3.1 Placing investment strategy orders

4.3.2 Actions and stores

4.3.3 Orchestration and choreography

4.4 Scoping by volatility

4.5 Technical capabilities

4.5.1 Sending notifications

4.5.2 When to use technical capabilities?

4.6 Dealing with ambiguity

4.6.1 Start with coarse-grained services

4.6.2 Prepare for further decomposition

4.6.3 Retirement and migration

4.7 Service ownership in organizations


5 Transactions and queries in microservices

5.1 Consistent transactions in distributed applications

5.1.1 Why can’t you use distributed transactions?

5.2 Event-based communication

5.2.1 Events and choreography

5.3 Sagas

5.3.1 Choreographed sagas

5.3.2 Orchestrated sagas

5.3.3 Interwoven sagas

5.3.4 Consistency patterns

5.3.5 Event sourcing

5.4 Queries in a distributed world

5.4.1 Storing copies of data

5.4.2 Separating queries and commands

5.4.3 CQRS challenges

5.4.4 Analytics and reporting

5.5 Further reading

5.6 Summary

6 Designing reliable services

6.1 Defining reliability

6.2 What could go wrong?

6.2.1 Sources of failure

6.2.2 Cascading failures

6.3 Designing reliable communication

6.3.1 Retries

6.3.2 Fallbacks

6.3.3 Timeouts

6.3.4 Circuit breakers

6.3.5 Asynchronous communication

6.4 Maximizing service reliability

6.4.1 Load balancing and service health

6.4.2 Rate limits

6.4.3 Validating reliability and fault tolerance

6.5 Safety by default

6.5.1 Frameworks

6.5.2 Service mesh


7 Building a reusable microservice framework

7.1 A microservice chassis

7.2 What’s the purpose of a microservice chassis?

7.2.1 Reduce risk

7.2.2 Faster bootstrapping

7.3 Designing a chassis

7.3.1 Service discovery

7.3.2 Observability

7.3.3 Balancing and limiting

7.4 Exploring the feature implemented using the chassis

7.5 Wasn’t heterogeneity one of the promises of microservices?

7.6 Summary

Part 3: Deployment

8 Deploying microservices

8.1 Why is deployment important?

8.1.1 Stability and availability

8.2 A microservice production environment

8.2.1 Features of a microservice production environment

8.2.2 Automation and speed

8.3 Deploying a service, the quick way

8.3.1 Service startup

8.3.2 Provisioning a virtual machine

8.3.3 Run multiple instances of your service

8.3.4 Adding a load balancer

8.3.5 What have you learned?

8.4 Building service artifacts

8.4.1 What’s in an artifact?

8.4.2 Immutability

8.4.3 Types of service artifacts

8.4.4 Configuration

8.5 Service to host models

8.5.1 Single service to host

8.5.2 Multiple static services per host

8.5.3 Multiple scheduled services per host

8.6 Deploying services without downtime

8.6.1 Canaries and rolling deploys on GCE


9 Deployment with containers and schedulers

9.1 Containerizing a service

9.1.1 Working with images

9.1.2 Building your image

9.1.3 Running containers

9.1.4 Storing an image

9.2 Deploying to a cluster

9.2.1 Designing and running pods

9.2.2 Load balancing

9.2.3 A quick look under the hood

9.2.4 Health checks

9.2.5 Deploying a new version

9.2.6 Rolling back

9.2.7 Connecting multiple services


10 Building a delivery pipeline for microservices

10.1 Making deploys boring

10.1.1 A deployment pipeline

10.2 Building a pipeline with Jenkins

10.2.1 Configuring a build pipeline

10.2.2 Building your image

10.2.3 Running tests

10.2.4 Publishing artifacts

10.2.5 Deploying to staging

10.2.6 Staging environments

10.2.7 Deploying to production

10.3 Building reusable pipeline steps

10.3.1 Procedural versus declarative build pipelines

10.4 Techniques for low-impact deployment and feature release

10.4.1 Dark launches

10.4.2 Feature flags


Part 4: Observability and ownership

11 Building a monitoring system

11.1 A robust monitoring stack

11.1.1 Good monitoring is layered

11.1.2 Golden signals

11.1.3 Types of metrics

11.2 Monitoring SimpleBank with Prometheus and Grafana

11.2.1 Setting up your metric collection infrastructure

11.2.2 Collecting infrastructure metrics—RabbitMQ

11.2.3 Instrumenting SimpleBank’s place order

11.2.4 Setting up alerts

11.3 Raising sensible and actionable alerts

11.3.1 Who needs to know when something is wrong?

11.3.2 Symptoms, not causes

11.4 Observing the whole application


12 Using logs and traces to understand behavior

12.1 Understanding behavior across services

12.1.1 Useful information to include in log entries

12.1.2 Structure and readability

12.2 Generating consistent, structured, human-readable logs

12.2.1 Useful information to include in log entries

12.2.2 Structure and readability

12.3 Setting up a logging infrastructure for SimpleBank

12.3.1 ELK- and Fluentd-based solution

12.3.2 Setting up your logging solution

12.3.3 Configure what logs to collect

12.3.4 Finding a needle in the haystack

12.3.5 Logging the right information

12.4 Tracing interactions between services

12.4.1 Correlating requests: traces and spans

12.4.2 Setting up tracing in your services

12.5 Visualizing traces


13 Building microservice teams

13.1 Building effective teams

13.1.1 Conway’s Law

13.1.2 Principles for effective teams

13.2 Team models

13.2.1 Grouping by function

13.2.2 Grouping across functions

13.2.3 Setting team boundaries

13.2.4 Infrastructure, platform, and product

13.2.5 Who’s on-call?

13.2.6 Sharing knowledge

13.3.1 Drivers of change in microservices

13.3.2 The role of architecture

13.3.3 Homogeneity versus technical flexibility

13.3.4 Open source model

13.3.5 Design review

13.3.6 Living documentation

13.3.7 Answering questions about your application

13.4 Further reading



Appendix A: Installing Jenkins on Minikube

A.1 Running Jenkins on Kubernetes

A.1.1 Setting up Helm

A.1.2 Create a namespace and a volume

A.1.3 Installing Jenkins

A.1.4 Configuring RBAC

A.1.5 Testing it all works

What's inside

  • An overview of microservice architecture
  • Building a delivery pipeline
  • Best practices for designing multi-service transactions and queries
  • Deploying with containers
  • Monitoring your microservices

About the reader

Written for intermediate developers familiar with enterprise architecture and cloud platforms like AWS and GCP.

About the authors

Morgan Bruce and Paulo A. Pereira are experienced engineering leaders. They work daily with microservices in a production environment, using the techniques detailed in this book.

placing your order...

Don't refresh or navigate away from the page.
print book $34.99 $49.99 pBook + eBook + liveBook
Additional shipping charges may apply
Prints and ships within 3-5 days
Microservices in Action (print book) added to cart
continue shopping
go to cart

eBook $27.99 $39.99 3 formats + liveBook
Microservices in Action (eBook) added to cart
continue shopping
go to cart

Prices displayed in rupees will be charged in USD when you check out.

FREE domestic shipping on three or more pBooks