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. You'll begin with an in-depth overview of microservice design principles, building on your knowledge of traditional systems. Then, you'll start creating a reliable road to production. You'll explore examples using Kubernetes, Docker, and Google Container Engine as you learn to build clusters and maintain them after deployment. Throughout this rich, experience-driven book, you'll move through real-world use cases including a continuous delivery pipeline, production monitoring, and practical techniques for scaling and maintaining a healthy system.
"Perfect fit for those who want to move their majestic monolith to a scalable microservice architecture."
~ Akshat Paul
"A must have for all people involved in this kind of job."
~ Antonio Pessolano
"An excellent guide for those who have embarked on their microservice journey."
~ Andy Miles
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. Why use microservices?
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: modelling the domain well
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. Stable and automated deployment
2.6. Scaling up microservice development
2.6.1. Technical divergence
2.7. What's next?
Part 2: Design
3. Architecture of a Microservices Application
3.1. Architecture as a whole
3.1.1. 3-tier architecture
3.1.2. 4-tier architecture
3.2. Aggregation Tier
3.2.1. API Gateways
3.2.2. Backends For Frontends
3.3. Event Backbone: More than just communicating
3.3.1. Reducing the need for orchestration
3.3.2. Events as a way of describing the system
3.3.3. Using events to replay the past
3.4. Benefits of decomposition
3.4.1. Geographically aware deployments
3.4.2. Data Sync: Who owns data?
3.5. Team Organization and Culture
3.5.1. Functional teams
3.5.2. Cross-functional Teams
3.5.3. Team Culture
4. Designing New Features
4.1. A new feature for SimpleBank
4.2. Scoping by business capabilities
4.2.1. Capabilities and domain modelling
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
4.7.1. Promote an internal open-source model
4.7.2. Evaluate wider impact when faced with contentious decisions
5. Distributed and (A)synchronous
5.1. Case Study: Buying and selling shares
5.2. Time for a theorem: CAP
5.2.1. Consistency and Partition tolerance
5.2.2. Availability and Partition tolerance
5.2.3. Does it have to always be AP or CP?
5.3. Communication: Synchronous and Asynchronous
5.3.1. Orchestration and Choreography
5.3.2. Going async: benefits and challenges
5.4. Event-based systems
5.4.1. Event Streams
5.4.2. Event Sourcing and CQRS
5.5. Long running transactions and dealing with failure
5.5.1. Two-phase commit
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.3. Timeouts and deadlines
6.3.4. Circuit breakers
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
7. Building a Reusable Microservice Framework
7.1. A microservice chassis
7.2. What is the purpose of microservice chassis?
7.2.1. Reduce risk
7.2.2. Faster bootstrapping
7.3. Designing a chassis
7.3.1. Service discovery
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?
Part 3: Deployment
8. Deploying Microservices
9. Deployment with Containers and Schedulers
10. Building a Delivery Pipeline for Microservices
Part 4: Monitoring & Observability
11. Building a Monitoring System
12. Using Logs and Traces to Understand Behaviour
13. Diagnosing Issues in an Evolving Application
14. Monitoring Deployments
About the Technology
Most enterprise developers are comfortable with writing individual components or services as part of a larger application. In microservice systems, the benefits - and unique challenges - arise from the way these services are organized, deployed, and managed. Production-ready microservice applications rely on cloud platforms like AWS or Google Cloud, container engines like Docker, and orchestration tools like Kubernetes. Microservices change the dev process as well, maximizing the efficiency and independence of small teams. To be successful, developers, team leaders, and architects need to master both the implementation details and the big picture of how microservices work in a production environment.
- Review of microservice architecture
- Building a delivery pipeline for microservices
- Monitoring your microservices applications
- Deploying with containers
- Written by authors with daily, hands-on experience
About the reader
Readers should be intermediate developers with some knowledge of enterprise application architecture. Familiarity with container systems like Docker and IaaS cloud like AWS, Google Cloud, or DigitalOcean is helpful but not required.
About the authors
Morgan Bruce and Paulo A. Pereira have years of experience building distributed applications, with particular expertise in the high-stakes finance and identity verification industries. They work daily with microservices in a production environment using the tools and techniques presented in this book.