Preface |
|
xvii | |
|
|
|
1 What Are Microservices? |
|
|
3 | (32) |
|
Microservices at a Glance |
|
|
3 | (3) |
|
Key Concepts of Microservices |
|
|
6 | (1) |
|
Independent Deployability |
|
|
6 | (1) |
|
Modeled Around a Business Domain |
|
|
7 | (1) |
|
|
8 | (1) |
|
|
9 | (1) |
|
|
10 | (1) |
|
Alignment of Architecture and Organization |
|
|
10 | (4) |
|
|
14 | (1) |
|
The Single-Process Monolith |
|
|
15 | (1) |
|
|
16 | (1) |
|
|
17 | (1) |
|
Monoliths and Delivery Contention |
|
|
17 | (1) |
|
|
18 | (1) |
|
|
18 | (1) |
|
Log Aggregation and Distributed Tracing |
|
|
19 | (1) |
|
Containers and Kubernetes |
|
|
20 | (1) |
|
|
21 | (1) |
|
Public Cloud and Serverless |
|
|
21 | (1) |
|
Advantages of Microservices |
|
|
22 | (1) |
|
|
22 | (1) |
|
|
23 | (1) |
|
|
24 | (1) |
|
|
25 | (1) |
|
|
25 | (1) |
|
|
26 | (1) |
|
|
26 | (1) |
|
|
26 | (1) |
|
|
27 | (1) |
|
|
28 | (1) |
|
|
28 | (1) |
|
Monitoring and Troubleshooting |
|
|
29 | (1) |
|
|
29 | (1) |
|
|
30 | (1) |
|
|
30 | (1) |
|
|
31 | (1) |
|
Should I Use Microservices? |
|
|
31 | (1) |
|
Whom They Might Not Work For |
|
|
31 | (2) |
|
|
33 | (1) |
|
|
34 | (1) |
|
2 How to Model Microservices |
|
|
35 | (36) |
|
|
35 | (1) |
|
What Makes a Good Microservice Boundary? |
|
|
36 | (1) |
|
|
36 | (2) |
|
|
38 | (1) |
|
|
38 | (1) |
|
The Interplay of Coupling and Cohesion |
|
|
39 | (1) |
|
|
39 | (2) |
|
|
41 | (2) |
|
|
43 | (3) |
|
|
46 | (3) |
|
|
49 | (2) |
|
Just Enough Domain-Driven Design |
|
|
51 | (1) |
|
|
52 | (1) |
|
|
53 | (3) |
|
|
56 | (2) |
|
Mapping Aggregates and Bounded Contexts to Microservices |
|
|
58 | (1) |
|
|
59 | (2) |
|
The Case for Domain-Driven Design for Microservices |
|
|
61 | (1) |
|
Alternatives to Business Domain Boundaries |
|
|
62 | (1) |
|
|
62 | (2) |
|
|
64 | (1) |
|
|
65 | (1) |
|
|
66 | (2) |
|
Mixing Models and Exceptions |
|
|
68 | (1) |
|
|
69 | (2) |
|
|
71 | (18) |
|
|
71 | (1) |
|
|
72 | (1) |
|
The Monolith Is Rarely the Enemy |
|
|
73 | (1) |
|
The Dangers of Premature Decomposition |
|
|
73 | (1) |
|
|
74 | (2) |
|
|
76 | (1) |
|
|
77 | (1) |
|
|
78 | (1) |
|
Useful Decompositional Patterns |
|
|
79 | (1) |
|
|
79 | (1) |
|
|
80 | (1) |
|
|
80 | (1) |
|
Data Decomposition Concerns |
|
|
81 | (1) |
|
|
81 | (3) |
|
|
84 | (1) |
|
|
84 | (1) |
|
|
85 | (1) |
|
|
85 | (1) |
|
|
86 | (3) |
|
4 Microservice Communication Styles |
|
|
89 | (32) |
|
From In-Process to Inter-Process |
|
|
89 | (1) |
|
|
90 | (1) |
|
|
91 | (1) |
|
|
91 | (2) |
|
Technology for Inter-Process Communication: So Many Choices |
|
|
93 | (1) |
|
Styles of Microservice Communication |
|
|
93 | (2) |
|
|
95 | (1) |
|
Pattern: Synchronous Blocking |
|
|
95 | (1) |
|
|
96 | (1) |
|
|
96 | (1) |
|
|
96 | (2) |
|
Pattern: Asynchronous Nonblocking |
|
|
98 | (1) |
|
|
99 | (1) |
|
|
100 | (1) |
|
|
101 | (1) |
|
Pattern: Communication Through Common Data |
|
|
101 | (1) |
|
|
102 | (1) |
|
|
103 | (1) |
|
|
103 | (1) |
|
|
104 | (1) |
|
Pattern: Request-Response Communication |
|
|
104 | (2) |
|
Implementation: Synchronous Versus Asynchronous |
|
|
106 | (2) |
|
|
108 | (1) |
|
Pattern: Event-Driven Communication |
|
|
108 | (2) |
|
|
110 | (1) |
|
|
111 | (4) |
|
|
115 | (1) |
|
|
116 | (1) |
|
|
117 | (4) |
|
|
|
5 Implementing Microservice Communication |
|
|
121 | (54) |
|
Looking for the Ideal Technology |
|
|
121 | (1) |
|
Make Backward Compatibility Easy |
|
|
121 | (1) |
|
Make Your Interface Explicit |
|
|
122 | (1) |
|
Keep Your APIs Technology Agnostic |
|
|
122 | (1) |
|
Make Your Service Simple for Consumers |
|
|
122 | (1) |
|
Hide Internal Implementation Detail |
|
|
123 | (1) |
|
|
123 | (1) |
|
|
123 | (4) |
|
|
127 | (6) |
|
|
133 | (2) |
|
|
135 | (5) |
|
|
140 | (1) |
|
|
140 | (1) |
|
|
141 | (1) |
|
|
141 | (1) |
|
Structural Versus Semantic Contract Breakages |
|
|
142 | (1) |
|
|
143 | (1) |
|
Handling Change Between Microservices |
|
|
144 | (1) |
|
Avoiding Breaking Changes |
|
|
144 | (1) |
|
|
145 | (1) |
|
|
145 | (1) |
|
|
146 | (1) |
|
|
146 | (2) |
|
Catch Accidental Breaking Changes Early |
|
|
148 | (1) |
|
Managing Breaking Changes |
|
|
149 | (1) |
|
|
149 | (1) |
|
Coexist Incompatible Microservice Versions |
|
|
149 | (1) |
|
Emulate the Old Interface |
|
|
150 | (2) |
|
Which Approach Do I Prefer? |
|
|
152 | (1) |
|
|
152 | (1) |
|
|
153 | (1) |
|
|
154 | (1) |
|
DRY and the Perils of Code Reuse in a Microservice World |
|
|
154 | (1) |
|
Sharing Code via Libraries |
|
|
155 | (2) |
|
|
157 | (1) |
|
|
157 | (2) |
|
Dynamic Service Registries |
|
|
159 | (2) |
|
|
161 | (1) |
|
Service Meshes and API Gateways |
|
|
162 | (1) |
|
|
163 | (3) |
|
|
166 | (3) |
|
What About Other Protocols? |
|
|
169 | (1) |
|
|
169 | (1) |
|
|
169 | (1) |
|
The Self-Describing System |
|
|
170 | (3) |
|
|
173 | (2) |
|
|
175 | (22) |
|
|
175 | (1) |
|
|
176 | (1) |
|
Still ACID, but Lacking Atomicity? |
|
|
177 | (2) |
|
Distributed Transactions---Two-Phase Commits |
|
|
179 | (2) |
|
Distributed Transactions---Just Say No |
|
|
181 | (1) |
|
|
182 | (2) |
|
|
184 | (5) |
|
|
189 | (6) |
|
Sagas Versus Distributed Transactions |
|
|
195 | (1) |
|
|
196 | (1) |
|
|
197 | (22) |
|
A Brief Introduction to Continuous Integration |
|
|
197 | (1) |
|
|
198 | (1) |
|
|
199 | (2) |
|
Build Pipelines and Continuous Delivery |
|
|
201 | (2) |
|
|
203 | (1) |
|
Trade-Offs and Environments |
|
|
203 | (1) |
|
|
204 | (1) |
|
Mapping Source Code and Builds to Microservices |
|
|
205 | (1) |
|
One Giant Repo, One Giant Build |
|
|
205 | (2) |
|
Pattern: One Repository per Microservice (aka Multirepo) |
|
|
207 | (3) |
|
|
210 | (7) |
|
Which Approach Would I Use? |
|
|
217 | (1) |
|
|
217 | (2) |
|
|
219 | (56) |
|
|
219 | (1) |
|
|
220 | (2) |
|
|
222 | (3) |
|
|
225 | (3) |
|
Principles of Microservice Deployment |
|
|
228 | (1) |
|
|
228 | (3) |
|
|
231 | (1) |
|
Infrastructure as Code (IAC) |
|
|
232 | (1) |
|
|
233 | (1) |
|
|
234 | (3) |
|
|
237 | (1) |
|
|
238 | (1) |
|
|
239 | (2) |
|
|
241 | (6) |
|
|
247 | (1) |
|
Platform as a Service (PaaS) |
|
|
248 | (1) |
|
Function as a Service (FaaS) |
|
|
249 | (8) |
|
Which Deployment Option Is Right for You? |
|
|
257 | (2) |
|
Kubernetes and Container Orchestration |
|
|
259 | (1) |
|
The Case for Container Orchestration |
|
|
259 | (1) |
|
A Simplified View of Kubernetes Concepts |
|
|
260 | (2) |
|
Multitenancy and Federation |
|
|
262 | (3) |
|
The Cloud Native Computing Federation |
|
|
265 | (1) |
|
Platforms and Portability |
|
|
265 | (1) |
|
Helm, Operators, and CRDs, Oh My! |
|
|
266 | (1) |
|
|
267 | (1) |
|
|
268 | (1) |
|
|
268 | (1) |
|
|
269 | (1) |
|
Separating Deployment from Release |
|
|
270 | (1) |
|
On to Progressive Delivery |
|
|
270 | (1) |
|
|
271 | (1) |
|
|
271 | (1) |
|
|
272 | (1) |
|
|
273 | (2) |
|
|
275 | (30) |
|
|
276 | (2) |
|
|
278 | (1) |
|
|
279 | (1) |
|
|
280 | (1) |
|
|
281 | (1) |
|
|
282 | (1) |
|
Implementing Service Tests |
|
|
283 | (1) |
|
|
283 | (1) |
|
|
284 | (1) |
|
Implementing (Those Tricky) End-to-End Tests |
|
|
285 | (1) |
|
|
286 | (1) |
|
Who Writes These End-to-End Tests? |
|
|
287 | (2) |
|
How Long Should End-to-End Tests Run? |
|
|
289 | (1) |
|
|
290 | (1) |
|
|
291 | (1) |
|
Lack of Independent Testability |
|
|
291 | (1) |
|
Should You Avoid End-to-End Tests? |
|
|
292 | (1) |
|
Contract Tests and Consumer-Driven Contracts (CDCs) |
|
|
292 | (3) |
|
|
295 | (1) |
|
|
296 | (1) |
|
From Preproduction to In-Production Testing |
|
|
297 | (1) |
|
Types of In-Production Testing |
|
|
298 | (1) |
|
Making Testing in Production Safe |
|
|
298 | (1) |
|
Mean Time to Repair over Mean Time Between Failures? |
|
|
299 | (1) |
|
|
300 | (1) |
|
|
301 | (1) |
|
|
302 | (1) |
|
|
303 | (2) |
|
10 From Monitoring to Observability |
|
|
305 | (40) |
|
Disruption, Panic, and Confusion |
|
|
305 | (1) |
|
Single Microservice, Single Server |
|
|
306 | (1) |
|
Single Microservice, Multiple Servers |
|
|
307 | (1) |
|
Multiple Services, Multiple Servers |
|
|
308 | (1) |
|
Observability Versus Monitoring |
|
|
309 | (1) |
|
The Pillars of Observability? Not So Fast |
|
|
310 | (1) |
|
Building Blocks for Observability |
|
|
311 | (1) |
|
|
312 | (9) |
|
|
321 | (3) |
|
|
324 | (3) |
|
|
327 | (2) |
|
|
329 | (4) |
|
|
333 | (2) |
|
|
335 | (2) |
|
|
337 | (1) |
|
|
338 | (1) |
|
|
338 | (1) |
|
|
339 | (1) |
|
|
339 | (1) |
|
|
339 | (1) |
|
|
340 | (1) |
|
The Expert in the Machine |
|
|
340 | (1) |
|
|
341 | (1) |
|
|
342 | (3) |
|
|
345 | (42) |
|
|
346 | (1) |
|
Principle of Least Privilege |
|
|
347 | (1) |
|
|
347 | (2) |
|
|
349 | (1) |
|
Build Security into the Delivery Process |
|
|
349 | (1) |
|
The Five Functions of Cybersecurity |
|
|
350 | (1) |
|
|
351 | (1) |
|
|
352 | (1) |
|
|
353 | (1) |
|
|
353 | (1) |
|
|
354 | (1) |
|
Foundations of Application Security |
|
|
354 | (1) |
|
|
354 | (6) |
|
|
360 | (3) |
|
|
363 | (1) |
|
|
364 | (1) |
|
Implicit Trust Versus Zero Trust |
|
|
365 | (1) |
|
|
366 | (1) |
|
|
366 | (1) |
|
|
367 | (2) |
|
|
369 | (1) |
|
|
369 | (3) |
|
|
372 | (3) |
|
Authentication and Authorization |
|
|
375 | (1) |
|
Service-to-Service Authentication |
|
|
375 | (1) |
|
|
376 | (1) |
|
Common Single Sign-On Implementations |
|
|
376 | (1) |
|
|
377 | (2) |
|
Fine-Grained Authorization |
|
|
379 | (1) |
|
The Confused Deputy Problem |
|
|
380 | (1) |
|
Centralized, Upstream Authorization |
|
|
381 | (1) |
|
Decentralizing Authorization |
|
|
382 | (1) |
|
|
382 | (4) |
|
|
386 | (1) |
|
|
387 | (32) |
|
|
387 | (1) |
|
|
388 | (1) |
|
|
389 | (1) |
|
|
390 | (1) |
|
|
390 | (1) |
|
And Microservice Architecture |
|
|
391 | (1) |
|
|
391 | (1) |
|
|
392 | (2) |
|
|
394 | (1) |
|
|
395 | (2) |
|
|
397 | (2) |
|
|
399 | (1) |
|
|
400 | (1) |
|
|
401 | (3) |
|
|
404 | (1) |
|
|
405 | (1) |
|
|
405 | (1) |
|
|
406 | (1) |
|
|
407 | (1) |
|
|
408 | (2) |
|
|
410 | (1) |
|
|
410 | (1) |
|
Sacrificing Partition Tolerance? |
|
|
411 | (1) |
|
|
411 | (1) |
|
|
412 | (1) |
|
|
412 | (1) |
|
|
413 | (1) |
|
|
414 | (1) |
|
|
415 | (1) |
|
From Robustness to Beyond |
|
|
415 | (1) |
|
|
415 | (2) |
|
|
417 | (2) |
|
|
419 | (36) |
|
|
419 | (1) |
|
|
420 | (2) |
|
|
422 | (4) |
|
|
426 | (4) |
|
|
430 | (2) |
|
|
432 | (1) |
|
|
433 | (2) |
|
|
435 | (1) |
|
|
436 | (1) |
|
|
436 | (1) |
|
|
436 | (1) |
|
|
437 | (5) |
|
|
442 | (5) |
|
The Golden Rule of Caching |
|
|
447 | (1) |
|
Freshness Versus Optimization |
|
|
448 | (1) |
|
Cache Poisoning: A Cautionary Tale |
|
|
448 | (1) |
|
|
449 | (1) |
|
|
450 | (1) |
|
|
451 | (4) |
|
|
|
|
455 | (36) |
|
|
456 | (1) |
|
|
456 | (2) |
|
Drivers for Dedicated Frontend Teams |
|
|
458 | (1) |
|
Toward Stream-Aligned Teams |
|
|
459 | (1) |
|
|
460 | (1) |
|
|
461 | (1) |
|
Working Through Technical Challenges |
|
|
462 | (1) |
|
Pattern: Monolithic Frontend |
|
|
463 | (1) |
|
|
464 | (1) |
|
|
464 | (1) |
|
|
465 | (1) |
|
|
465 | (2) |
|
Pattern: Page-Based Decomposition |
|
|
467 | (1) |
|
|
468 | (1) |
|
Pattern: Widget-Based Decomposition |
|
|
469 | (1) |
|
|
470 | (3) |
|
|
473 | (1) |
|
|
474 | (1) |
|
Pattern: Central Aggregating Gateway |
|
|
475 | (1) |
|
|
476 | (1) |
|
Different Types of User Interfaces |
|
|
477 | (1) |
|
|
478 | (1) |
|
|
479 | (1) |
|
Pattern: Backend for Frontend (BFF) |
|
|
480 | (1) |
|
|
481 | (2) |
|
|
483 | (3) |
|
BFFs for Desktop Web and Beyond |
|
|
486 | (1) |
|
|
487 | (1) |
|
|
488 | (1) |
|
|
489 | (1) |
|
|
490 | (1) |
|
15 Organizational Structures |
|
|
491 | (34) |
|
Loosely Coupled Organizations |
|
|
491 | (2) |
|
|
493 | (1) |
|
|
493 | (2) |
|
|
495 | (1) |
|
Understanding Conway's Law |
|
|
496 | (1) |
|
Small Teams, Large Organization |
|
|
496 | (2) |
|
|
498 | (1) |
|
Strong Versus Collective Ownership |
|
|
499 | (1) |
|
|
500 | (1) |
|
|
501 | (1) |
|
At a Team Level Versus an Organizational Level |
|
|
502 | (1) |
|
|
502 | (1) |
|
|
503 | (2) |
|
|
505 | (1) |
|
|
506 | (3) |
|
|
509 | (1) |
|
|
509 | (1) |
|
|
509 | (1) |
|
|
510 | (1) |
|
|
511 | (1) |
|
Role of the Core Committers |
|
|
511 | (1) |
|
|
512 | (1) |
|
|
512 | (1) |
|
Pluggable, Modular Microservices |
|
|
513 | (2) |
|
|
515 | (3) |
|
|
518 | (1) |
|
Case Study: realestate.com.au |
|
|
519 | (2) |
|
Geographical Distribution |
|
|
521 | (1) |
|
|
522 | (1) |
|
|
523 | (1) |
|
|
524 | (1) |
|
16 The Evolutionary Architect |
|
|
525 | (26) |
|
|
525 | (2) |
|
What Is Software Architecture? |
|
|
527 | (2) |
|
|
529 | (1) |
|
An Evolutionary Vision for the Architect |
|
|
529 | (1) |
|
Defining System Boundaries |
|
|
530 | (3) |
|
|
533 | (1) |
|
|
534 | (2) |
|
|
536 | (1) |
|
|
536 | (1) |
|
|
536 | (1) |
|
|
537 | (1) |
|
Combining Principles and Practices |
|
|
537 | (1) |
|
|
538 | (1) |
|
Guiding an Evolutionary Architecture |
|
|
539 | (1) |
|
Architecture in a Stream-Aligned Organization |
|
|
540 | (2) |
|
|
542 | (1) |
|
|
543 | (1) |
|
|
543 | (1) |
|
|
543 | (1) |
|
|
544 | (1) |
|
Governance and the Paved Road |
|
|
544 | (1) |
|
|
545 | (1) |
|
Tailored Microservice Template |
|
|
545 | (2) |
|
|
547 | (1) |
|
|
547 | (1) |
|
|
548 | (1) |
|
|
548 | (3) |
Afterword: Bringing It All Together |
|
551 | (12) |
Bibliography |
|
563 | (6) |
Glossary |
|
569 | (6) |
Index |
|
575 | |