Part 3 · Blueprint 13
Monolith vs. Microservices Architecture
12 min reading · Sources · Editorial review pending
A network boundary adds waiting and partial failure to a responsibility split.
Page details
Published date · Last edited:
Draft edition. Editorial review and supplementary reading recommendations are still being completed.
Format: Architecture walkthrough. Prerequisites: the beginner bootcamp. Chapter prerequisites: SQL vs. NoSQL vs. NewSQL Storage Engines, Message Queues & Event Streams: Kafka vs. RabbitMQ, Idempotency Keys & Distributed Retries.
Sixty-second mental model
Problem: A network boundary adds waiting and partial failure to a responsibility split.
Use: Start with a modular boundary and extract only for an explicit benefit.
Design boundary: Choose service boundaries around change ownership and invariants. Independent deployment can be useful, but moving a transaction across the network creates new uncertainty and coordination costs. Start with a modular single deployment when it satisfies the workload and team needs.
Layer 1 · Intuition
Hypothetical scenario: Northwind is designing service boundaries. Maya represents product requirements, Dev implementation and Priya reliability. The team must agree what one call means and which component owns the business capability.
Think of departments sharing a building before opening separate offices. Separate the requester from business capability, then identify the retained evidence needed after failure.
- Authority
- The entitled state owner.
- Invariant
- A rule preserved across concurrency and failures.
- Process
- A running program instance with execution state and an address space. Analogy: A workshop with its own working area.
- Thread
- An execution sequence within a process that can share its memory. Analogy: A worker operating in the same workshop.
Architecture and worked reasoning
Design boundary: Choose service boundaries around change ownership and invariants. Independent deployment can be useful, but moving a transaction across the network creates new uncertainty and coordination costs. Start with a modular single deployment when it satisfies the workload and team needs.
Responsibilities on the request path
Workload and limiting resource
A hypothetical checkout makes three serial remote calls of 20 ms each, adding 3 × 20 = 60 ms before retries and queueing. Replacing local calls with network calls changes both latency and failure states. If each call were independently successful with probability 0.99, all three succeed with 0.99³ = 0.970299; independence is an assumption, not a measured reliability claim.
Keep the units attached to each intermediate result. The assumptions above describe a hypothetical exercise, not observed vendor capacity. A real capacity decision also needs a measured service curve, skew, recovery traffic and an explicit admission policy for overload.
Mutation or publication path
- Keep a local transaction where the invariant is local.
- Define an explicit contract before extracting a module.
- Introduce recoverable cross-service coordination only for a real boundary.
Observation and recovery path
- Identify which service owns each field.
- Query through an authorized interface or owned projection.
- Avoid joining arbitrary private databases as if ownership were unchanged.
Failure that changes the decision
Hypothetical scenario: An extracted inventory service times out after reserving stock. The order service cannot treat that timeout as a confirmed rejection; it needs identity, status recovery and compensation rules.
Attempt this decision before reading the explanation
Must a high-traffic application use microservices?
No. Scale can often be addressed with replication, partitioning and worker separation within a modular deployment. Extract a service when its ownership, operational or scaling boundary justifies the distributed-system costs.
Supporting mechanism analysis
Hypothetical scenario: Northwind. Maya represents product, Dev implementation and Priya reliability. The following workflow develops the underlying mechanism.
Hypothetical scenario. Northwind’s workers can now receive requests, and another team offers to own price formatting as a separate service. Dev likes the clearer deployment boundary. Priya asks what the visitor sees when that new service is slow.
This lets a module remain the baseline while making the reason for a separate service reviewable. The next sections explain what crosses that boundary.
Northwind can first keep formatting as a module in each catalogue worker. This does not forbid a later service. It asks which concrete requirement needs independent deployment, scaling, access control or ownership strongly enough to justify another remote dependency. Merely naming responsibilities is insufficient evidence for distribution.
For one product read, Northwind needs an identifier, the selected market and currency, a product version and enough evidence to evaluate the sixty-second price-age rule. State what missing, withdrawn and temporarily unavailable mean. An empty list that ambiguously means either “no matching products” or “dependency failed” prevents the caller from making an honest presentation decision.
HTTP Semantics supplies the protocol vocabulary. Application contracts add the interpretation relevant to Northwind. For example, successful protocol delivery does not establish that the application returned the requested market, and a validly encoded response can still violate the freshness rule.
The formatter owns presentation, not the authoritative price. Its reply must retain currency, source revision and evidence time; generating a new response timestamp cannot refresh old source evidence. A versioned contract also defines whether unknown optional fields may be ignored and how a new required field is introduced without breaking older callers.
Hypothetical worked example. The application path becomes 10 + 20 + 40 + 35 + 10 = 115 ms. Substituting into the cold-path ledger gives 290 − 80 + 115 = 325 ms, leaving 400 − 325 = 75 ms. These chosen terms include the added call’s communication and remote wait; do not add that same communication time again elsewhere.
The selected cold-path budget left 190 ms for application waiting after setup, transfer and presentation reservations. Ingress, preparation and the product lookup consume 10 + 20 + 40 = 70 ms. Keeping 10 ms for assembly leaves 190 − 70 − 10 = 110 ms for the formatter under that model.
gRPC’s deadline guidance describes this propagation concern. Cancellation must reach activities that can stop; it should not be treated as proof of rollback. Although the present operation is read-only, later write workflows will need to distinguish stopped waiting from known failure of an effect.
HTTP and gRPC provide documented mechanisms for exchanging requests and bounding waits. Their public specifications and guides are useful because they make behavior inspectable. They do not tell Northwind whether formatting deserves a separate team-owned service. That architectural decision still depends on change patterns, deployment needs and the failure cost created by the boundary.
Hypothetical failure scenario. The formatting service is unavailable. Product records remain healthy, but the catalogue waits until the visitor deadline expires because formatting was made a required serial dependency. The team intended organizational independence and instead increased the ways browsing could fail.
Separate a service when a concrete need for independent change, ownership or scaling outweighs the added communication and operations burden. Keep a module when cohesive responsibilities can evolve together and remote independence adds little. Neither choice is permanently correct for every stage of the product.
Layer 3 · Internals
Trade-offs and limits
| Approach | Provides | Requires |
|---|---|---|
| Modular monolith | Preserves in-process calls and a smaller deployment boundary. | Teams must maintain explicit internal ownership instead of relying on network separation. |
| Independent service | Can isolate deployment, resource needs and responsibility. | Adds network waiting, partial failure and distributed change coordination. |
Recovery decision
Hypothetical scenario: An extracted inventory service times out after reserving stock. The order service cannot treat that timeout as a confirmed rejection; it needs identity, status recovery and compensation rules.
No. Scale can often be addressed with replication, partitioning and worker separation within a modular deployment. Extract a service when its ownership, operational or scaling boundary justifies the distributed-system costs.
Write your design before revealing the review
Must a high-traffic application use microservices?
Drafts and self-review are stored only in this browser. They are separate from reading completion.
Compare your decision
No. Scale can often be addressed with replication, partitioning and worker separation within a modular deployment. Extract a service when its ownership, operational or scaling boundary justifies the distributed-system costs.
An extracted inventory service times out after reserving stock. The order service cannot treat that timeout as a confirmed rejection; it needs identity, status recovery and compensation rules.
Check your understanding
Must a high-traffic application use microservices?
No. Scale can often be addressed with replication, partitioning and worker separation within a modular deployment. Extract a service when its ownership, operational or scaling boundary justifies the distributed-system costs.
How would you recover from this failure: An extracted inventory service times out after reserving stock. The order service cannot treat that timeout as a confirmed rejection; it needs identity, status recovery and compensation rules.
Start with the exact boundary that failed. Keep a local transaction where the invariant is local. Define an explicit contract before extracting a module. Introduce recoverable cross-service coordination only for a real boundary. Then recover evidence through the observation path: Identify which service owns each field. Query through an authorized interface or owned projection. Avoid joining arbitrary private databases as if ownership were unchanged. Preserve the distinction between a confirmed state change and an unavailable response.
Which assumption in the worked calculation would a burst or concentrated tenant invalidate first?
A hypothetical checkout makes three serial remote calls of 20 ms each, adding 3 × 20 = 60 ms before retries and queueing. Replacing local calls with network calls changes both latency and failure states. If each call were independently successful with probability 0.99, all three succeed with 0.99³ = 0.970299; independence is an assumption, not a measured reliability claim. Recompute the affected resource rather than multiplying unrelated storage and network budgets by the same factor. Choose service boundaries around change ownership and invariants. Independent deployment can be useful, but moving a transaction across the network creates new uncertainty and coordination costs. Start with a modular single deployment when it satisfies the workload and team needs.
Which component in this topology could be removed from a smaller first deployment?
Checkout module, Inventory module, Order database, Event boundary name responsibilities, not a requirement for separate processes. Co-locate responsibilities when their transaction, trust and capacity boundaries permit it. Keep a local transaction where the invariant is local.
What evidence must a caller have before relying on the observation path?
Identify which service owns each field. Query through an authorized interface or owned projection. Avoid joining arbitrary private databases as if ownership were unchanged. No. Scale can often be addressed with replication, partitioning and worker separation within a modular deployment. Extract a service when its ownership, operational or scaling boundary justifies the distributed-system costs.
45-minute interview rubric
- 00–05: scope call and business capability.
- 05–12: identify the limiting resource and derive the domain workload above, retaining units and assumptions.
- 12–28: draw business capability, numbered writes and reads.
- 28–40: challenge recovery: Start with a modular boundary and extract only for an explicit benefit.
- 40–45: defend operation_id placement, observations and remaining assumptions.
Go deeper
- Strangler Fig · Primary document · martinfowler.com. Start with a modular boundary and extract only for an explicit benefit. Verified 2026-10-26.
- Deadlines | gRPC · Primary document · grpc.io. Start with a modular boundary and extract only for an explicit benefit. Verified 2026-10-26.
- RFC 9110: HTTP Semantics · Primary document · www.rfc-editor.org. Start with a modular boundary and extract only for an explicit benefit. Verified 2026-10-26.
Decision log
Start with a modular boundary and extract only for an explicit benefit.
Preserve call identity and business capability ownership.
Revisit changed workload, observations or recovery objectives.