Preface

Leave a rating for Practical System Design on Amazon. (opens in a new tab)
Pr · 1/25 · 0%

PrPreface

Preface

Ask a group of engineers to design a new system and, before long, someone will walk to the whiteboard and start drawing boxes and arrows. We might begin with an API and a database, then add a cache or a queue as the discussion continues. Once there is something to look at, we can ask where the data comes from, how requests move through the application, and which components depend on one another. I have been in enough of these reviews to appreciate how much easier a design becomes to discuss when everyone can see the same drawing.

A diagram can look complete before we have decided what the application will do when something goes wrong. Suppose our API sends a payment request and receives no response. The provider might already have authorized the payment. The customer may try again while our database has no confirmed result from the first attempt. We need to know how the application will recognize that original operation, what it can tell the customer, and when another provider call would be safe. The boxes and arrows give us a place to examine those questions, but we still have to answer them.

Most engineering work also begins with systems that are already running. A developer adds a query, it passes its functional tests, and the team deploys it. Once customers begin using the feature, its additional database calls compete for connections needed by other parts of the application. The change may have been small in the codebase, yet its effect depends on the traffic, dependency capacity, and failure behavior of the existing system. A design review gives us a chance to examine those consequences before they become a production incident.

We will return to these decisions through Baodium, the fictional marketplace used throughout the book. Its product pages, checkout, and notifications let us follow a change from application code to the services it calls, the resources it consumes, and the records it leaves after a failure. As the system grows, we will revisit earlier decisions under new operating conditions. We will also design messaging, booking, SaaS, and engineering platforms, where the business operations call for different architectures.

Along the way, we will examine how to construct a design from its requirements. If an operation needs an atomic update, we will look at where that transaction belongs. If a workflow can continue after the HTTP response, we will consider durable state and asynchronous processing. If the workload exceeds one machine’s capacity, we will examine which part of the system actually needs to scale. The components follow from the behavior the application must support.

We will calculate capacity when the result changes a decision and examine the transaction, API contract, or configuration setting that makes the decision enforceable. You will encounter PostgreSQL, Redis, Kubernetes, and Kafka where their behavior matters. I want us to understand each choice well enough to recognize when another approach would be more appropriate.

The first chapter begins with a feature added to an existing product page and the database contention that followed. Later, an interrupted payment leads us to durable operation identities, and an outdated replica leads us to data freshness and write ownership. By Chapter 14, we can bring these mechanisms together to review a European launch and its regional failure scenarios. Appendix B applies the same approach to four other designs, including a service that validates engineering changes before deployment.

Five questions recur throughout the book. What has the application promised? Which work can one request create? What survives interruption? What happens when a limit is reached? Which evidence changes the decision? We will revisit these questions as the examples develop. Each chapter includes a Decide for yourself case where more than one solution may initially seem reasonable. The Hidden Assumptions review records the constraints, evidence, controls, and owners that would matter when the system is operating.

Experience with an HTTP application, a database, and a basic deployment process is enough to begin. Baodium’s measurements are illustrative. They help us examine the calculations and tradeoffs, but they are not performance benchmarks for any technology. A real system needs evidence from its own traffic and failure tests.

My hope is that, when you face a system you have never designed before, you will know where to begin. We can establish what the application must do, choose components whose guarantees meet those requirements, and identify the conditions under which the design may fail. We can then test our assumptions and revise the architecture as the evidence changes. That is the engineering judgment I have tried to share in these chapters.

Adewale Obadimu