LOAD-BEARINGfree
High-level designTier 5 · unit 1 of 5 · 14 min read

Where a service ends

Every tier so far has quietly assumed an answer to a question nobody asked. Tier 2 designed the inside of one service. Tier 4 ran many copies of that one service. But how many different services should exist at all, and where does one stop and the next begin? That is the boundary question, and it is the single most expensive decision in this course — because every other decision can be revisited on a Tuesday afternoon, and this one cannot.

The question that produces bad answers

Ask a team "what should our services be?" and you will almost always get a list of nouns: UserService, OrderService, ProductService, PaymentService. It feels obviously right. It maps to the database tables. Everyone nods.

Now trace one real operation through it. "Place an order" needs to read the user, check the product, decrement stock, create the order, charge the card. That is five services in one user action, and every one of them is a network call that can be slow, can fail, and cannot participate in your transaction. You have built what people call entity services — CRUD wrappers around tables, dressed as architecture. The business logic didn't get a home; it got homeless, and now it lives in whichever caller assembled the pieces this week.

The nouns were never the seam. They were the schema, and you drew service boundaries around the schema because it was the only map on the table.

The question that produces good answers

Here is the reframing that makes this tier work:

A service boundary is a transaction boundary. Find the things that must change together, and do not put a network between them.

Go back to Tier 2's double-booking bug — two users, one seat, both see "available", both book. The fix was an atomic operation: check and write in one indivisible step. Tier 3 gave you the machinery to do that across several rows: a transaction. That machinery has a hard edge. It works inside one database. It does not cross a service boundary, and Lesson 6.05 will spend a whole lesson on the elaborate, lossy, second-best patterns you are forced into when you need it to.

So the test is: what must be true at every instant, and what does enforcing it require? Those rules are your invariants — Tier 2's word, now operating at architecture scale.

  • "A seat is booked by at most one person." Seat state and booking must be one transaction. Same service.
  • "An account balance never goes negative." Balance and the debit must be one transaction. Same service.
  • "An order's line items sum to its total." Order and lines must be one transaction. Same service.
  • "A user who places an order gets a confirmation email." Nothing here is instantaneous. Different service, happily.

The cluster of data that one invariant governs has a name: an aggregate. It is the unit you load, change, and save atomically. A service owns whole aggregates — never half of one. An invariant that spans two services is not a design; it is a bug you have already shipped and not yet noticed.

The second seam: the same word meaning two things

Transaction boundaries tell you what must stay together. The other half of the answer tells you what wants to come apart, and it shows up as a vocabulary argument.

"Customer" in the sales system is a pipeline stage, a deal size, a contact history. "Customer" in billing is a payment method, a tax jurisdiction, a dunning state. "Customer" in support is a ticket history and an SLA tier. Three teams, one word, three genuinely different meanings — and a meeting every quarter about whose fields go in the shared customer table.

That meeting is the boundary announcing itself. A bounded context is the region within which one word means exactly one thing. Two contexts can both have a customer; they are simply not the same object, and forcing them into one model produces a class with forty fields where each team uses nine and dares not delete the rest.

The practical tell: when a rename argument keeps recurring, you are looking at a seam, not a naming problem.

Three more signals, all weaker than the first two

Once the invariants and the vocabulary have spoken, these refine the picture — and none of them on its own justifies a split:

  • Rate of change. Code the pricing team edits weekly does not want to share a deploy with code nobody has touched in two years. Frequency of change is a cheap proxy for "different reasons to exist".
  • Shape of load. The video transcoder wants GPUs and runs for forty minutes. The API wants to answer in twenty milliseconds. Sharing a process means sizing for both and getting neither right.
  • Blast radius. Payments must not go down because the recommendations deploy went badly. When two things have genuinely different consequences for failure, a process boundary is also a containment boundary — Tier 9's bulkhead, drawn at the level of the org chart.

The one-line test

Before you commit to a boundary, ask: can this service still be correct when every other service is unreachable?

For the writes it owns, the answer must be yes. It may be degraded, it may be queuing things up, it may be refusing new work — but the data it is responsible for must not be able to go wrong just because a neighbour went dark. If the honest answer is "no, it needs to call inventory before it can accept the write, or it might oversell", then you have not found a boundary. You have found a transaction with a network cable run through the middle of it.

The trap

Splitting by technical layer instead of by responsibility: an "API service", a "business logic service", a "data access service". It looks tidy on the whiteboard — it is the layered diagram everyone drew in university, now with network calls between the layers. The consequence is that every single feature touches all three, so no team can ship anything alone, no service can be understood alone, and you have paid the full price of distribution to make your monolith slower. Boundaries run vertically, through the business, not horizontally through the stack.