Building Microservices
Designing Fine-Grained Systems
sufficient
reading path: overview → analysis → narration
overview
Overview
Building Microservices (2021, Second Edition) by Sam Newman is the comprehensive guide to designing, building, and operating systems using the microservice architectural style. Newman covers the entire lifecycle from decomposition strategies to production operations.
The second edition has been substantially updated to reflect the maturing microservice landscape, with new chapters on Kubernetes, serverless, observability, and the reconciliation of microservices with monoliths.
Key Takeaways
-
Microservices are not a free lunch. They introduce complexity in testing, deployment, networking, and data management.
-
Domain-driven design is the foundation. Service boundaries should align with business domain boundaries, not technical layers.
-
Choose integration technology carefully. REST, gRPC, and messaging each have different trade-offs for coupling, performance, and evolvability.
-
Data decentralization is essential. The database-per-service pattern prevents tight coupling through shared schemas.
-
Observability is non-negotiable. Without centralized logging, metrics, and distributed tracing, microservices are unmanageable.
-
Testing microservices requires strategy. Move from a testing pyramid to a testing trophy — emphasize contract and integration tests over unit tests.
-
Organizational alignment matters. Conway's Law means your architecture will mirror your communication structures.
-
Start with a monolith. Extract microservices as you discover natural boundaries rather than predicting them upfront.
-
Kubernetes changes everything. Container orchestration simplifies deployment but adds operational complexity.
-
Idempotency is your friend. Design operations to be safe to retry, and design for partial failure.
Who Should Read
| Reader Type | Why | |---|---| | Software architects | Framework for decomposition and integration decisions | | Senior backend engineers | Practical patterns for building distributed systems | | Technical leads | Insight into organizational and technical trade-offs | | CTOs and VPs of Engineering | Understanding the costs and benefits before committing | | Platform engineers | Guidance on infrastructure for microservice deployments |
Who Should Skip
- Junior developers with less than 2 years of experience
- Teams of fewer than 5 developers — the complexity outweighs benefits
- Anyone building a simple CRUD application with a single database
Related Books
| Book | Author | Connection | |---|---|---| | Designing Data-Intensive Applications | Martin Kleppmann | Distributed systems foundations for microservices | | The Twelve-Factor App | Adam Wiggins | Best practices for cloud-native applications | | Monolith to Microservices | Sam Newman | Migration patterns for existing systems | | Accelerate | Nicole Forsgren | Metrics for measuring delivery performance | | Site Reliability Engineering | Beyer et al. | Operating reliable distributed systems |
Final Verdict
The definitive practical guide to microservices. Newman balances enthusiasm with caution, clearly laying out when microservices help and when they hurt. The second edition is significantly better than the first.
Rating: 8.5/10 — Essential reading for anyone considering or already using microservices.
content map
The Microservice Mindset
Microservices are independently deployable services modeled around business domains. Each service owns its data, runs in its own process, and communicates via well-defined APIs.
graph TD
subgraph Monolith["Monolithic Architecture"]
UI["User Interface"]
BL["Business Logic"]
DB["Database"]
UI --> BL --> DB
end
subgraph Microservices["Microservice Architecture"]
S1["Service A<br/>(Orders)"]
S2["Service B<br/>(Payments)"]
S3["Service C<br/>(Shipping)"]
S4["Service D<br/>(Notifications)"]
GW["API Gateway"]
GW --> S1
GW --> S2
GW --> S3
GW --> S4
end
Service Decomposition
Newman recommends using bounded contexts from Domain-Driven Design to identify service boundaries.
| Decomposition Strategy | Approach | Best For | |----------------------|----------|----------| | Business capability | Map to business functions | Stable domains | | Subdomain | Follow DDD bounded contexts | Complex domains | | Volatility | Separate by change frequency | Rapidly evolving features |
Inter-Service Communication
flowchart LR
subgraph Synchronous["Synchronous"]
R["REST / gRPC"]
R -->|"Request/Response"| S["Service"]
end
subgraph Asynchronous["Asynchronous"]
M["Message Broker"]
P["Producer"] --> M
M --> C["Consumer 1"]
M --> C2["Consumer 2"]
end
Data Management
The database-per-service pattern is central to microservices:
graph TD
subgraph Service_Data["Data per Service"]
S1["Order Service"] --> DB1["Order DB"]
S2["Payment Service"] --> DB2["Payment DB"]
S3["Shipping Service"] --> DB3["Shipping DB"]
end
subgraph Patterns["Data Sharing Patterns"]
P1["Saga Pattern<br/>(eventual consistency)"]
P2["CQRS<br/>(read vs write models)"]
P3["Event Sourcing<br/>(event store)"]
end
Observability
| Pillar | Tool Examples | What It Answers | |--------|--------------|-----------------| | Logging | ELK Stack, Loki | What happened? | | Metrics | Prometheus, Datadog | When did it happen? | | Tracing | Jaeger, Zipkin | Where did it happen? |
Testing Strategy
Newman advocates moving from the testing pyramid to a testing trophy:
- Unit tests — fast, isolated, high coverage
- Contract tests — verify service interactions
- Integration tests — test against real dependencies
- End-to-end tests — critical paths only
Deployment and Containers
graph LR
subgraph Pipeline["CI/CD Pipeline"]
C["Commit"] --> B["Build"]
B --> T["Test"]
T --> P["Package (Docker)"]
P --> D["Deploy"]
end
subgraph Orchestration["Orchestration"]
D --> K["Kubernetes"]
K --> N1["Pod 1"]
K --> N2["Pod 2"]
K --> N3["Pod 3"]
end
Reading Guide
| Chapter | Topic | Est. Time | Priority | |---------|-------|-----------|----------| | 1-2 | Microservice fundamentals | 2h | Essential | | 3-4 | Decomposition and DDD | 2.5h | Essential | | 5-6 | Communication patterns | 3h | Essential | | 7-8 | Data and transactions | 2.5h | Essential | | 9-10 | Testing and deployment | 3h | Important | | 11-13 | Monitoring and security | 2h | Important | | 14-16 | Organizational and migration | 2h | Important |
analysis
Strengths
- Comprehensive coverage. Covers the entire microservice lifecycle from decomposition to production operations.
- Pragmatic approach. Newman acknowledges when microservices are not the right choice, unlike many evangelists.
- Second edition improvements. Significantly updated with Kubernetes, serverless, and observability content.
- Real-world examples. Draws on experience from ThoughtWorks projects across many organizations.
- Organizational perspective. Includes Conway's Law, team structures, and migration strategies.
- Clear writing. Technical concepts are explained with clarity.
Weaknesses
- Length can be daunting. At 612 pages, the book is comprehensive but could be tighter.
- Some sections are shallow. Topics like service mesh, event sourcing, and CQRS deserve deeper treatment.
- Kubernetes focus may date. The emphasis on Kubernetes as the deployment platform may not age well.
- Light on code. The book is architectural — few concrete code examples.
Criticism
The "Microservice Hype" Critique
Some critics argue that the book overstates the benefits of microservices without adequately emphasizing the costs. Organizations without significant scale often take on unnecessary complexity.
The "Too ThoughtWorks" Critique
The book draws heavily on ThoughtWorks' experiences, which some critics argue is not representative of most engineering organizations.
The "Second Edition Still Not Enough" Critique
While substantially updated, some topics like WebAssembly, eBPF, and edge computing are not covered.
Comparison with Similar Books
| Book | vs. Building Microservices | |------|---------------------------| | Monolith to Microservices (Newman) | Migration-specific companion | | Designing Data-Intensive Applications (Kleppmann) | Data and distributed systems depth | | Team Topologies (Skelton & Pais) | Organizational design focus | | Accelerate (Forsgren) | Metrics for DevOps effectiveness |
Scientific Grounding
| Concept | Source | |---------|--------| | Conway's Law | Melvin Conway (1968) | | DDD Bounded Contexts | Eric Evans (2003) | | CAP Theorem | Eric Brewer (2000) | | Twelve-Factor App | Adam Wiggins (2011) |
Final Assessment
| Dimension | Rating | Notes | |-----------|--------|-------| | Depth | 8/10 | Broad but not always deep | | Breadth | 9/10 | Covers all major topics | | Readability | 8/10 | Clear and practical | | Practical Utility | 8/10 | Actionable guidance | | Lasting Value | 7/10 | Some parts will age | | Overall | 8.0/10 | Essential microservices reference |
narration
Welcome to BookAtlas. Today, we explore Building Microservices by Sam Newman, the second edition published in 2021 by O'Reilly Media. At 612 pages, this is the comprehensive guide to designing, building, and operating microservice-based systems.
Sam Newman is a ThoughtWorks veteran who has helped numerous organizations adopt microservices. The second edition reflects how the microservice landscape has matured since the first edition was published in 2015, adding substantial coverage of Kubernetes, serverless, observability, and the important realization that microservices are not always the right choice.
The central thesis of the book is that microservices are independently deployable services modeled around business domains. Newman emphasizes that this is as much an organizational decision as a technical one, rooted in Conway's Law, which states that organizations design systems that mirror their communication structures.
Newman starts with service decomposition, recommending that you use bounded contexts from Domain-Driven Design to identify service boundaries. He advises against a big bang microservice adoption, instead recommending that you start with a well-structured monolith and extract microservices as you discover natural boundaries through experience. This pragmatic advice sets the tone for the entire book.
For inter-service communication, Newman covers the full spectrum from synchronous REST and gRPC to asynchronous messaging with brokers. He explains the trade-offs clearly. Synchronous communication is simpler and more intuitive but creates temporal coupling between services. Asynchronous communication provides resilience and scalability but adds complexity in message handling, idempotency, and error recovery.
The data management chapter is one of the most important. Newman advocates strongly for the database-per-service pattern, which prevents tight coupling through shared schemas. This creates a new challenge, however. Maintaining data consistency across services requires patterns like sagas for eventual consistency and CQRS for separating read and write models. Newman acknowledges that this is the area where microservices introduce the most significant complexity compared to monolithic architectures.
Observability is treated as non-negotiable. Newman argues that centralized logging, metrics, and distributed tracing are essential for operating microservices at scale. Without these three pillars, debugging a failed request across services becomes nearly impossible. The book covers the practical tooling for each pillar.
The testing chapter presents a notable shift from the traditional testing pyramid. Newman advocates for a testing trophy approach that emphasizes contract tests and integration tests over unit tests. Contract tests, using tools like Pact, verify that service interactions match expectations. This approach catches integration issues before deployment.
The second edition's coverage of Kubernetes and containers reflects the industry's convergence on container orchestration as the standard deployment platform. Newman covers the key Kubernetes concepts that microservice operators need to understand: pods, services, deployments, and ingress.
On the organizational side, Newman discusses team topology, recommending that teams be aligned with service boundaries. He also addresses the important question of when not to use microservices. Teams smaller than five developers, simple CRUD applications, and organizations without strong DevOps practices should think carefully before adopting the microservice architecture.
Building Microservices earns an 8.5 out of 10 on the BookAtlas scale. It is essential reading for anyone considering or already building microservices. Newman balances enthusiasm with caution, clearly laying out when microservices help and when they hurt. This has been a BookAtlas narration of Building Microservices by Sam Newman. Thanks for listening.