Volume 7 · Chapter 1 — Microservices and System Design
Microservices versus Monolith
1.1 Introduction
System design starts with a fundamental architectural choice: one large application (a monolith) or many small independently-deployable services (microservices). This is one of the most common senior-interview topics, and the mature answer is never a dogmatic “microservices are better” - it’s understanding the trade-offs and choosing deliberately for the context. This chapter frames that choice honestly, because getting it right shapes everything else in a system’s design, and getting it wrong - microservices adopted without need - creates enormous accidental complexity.
1.2 The Monolith
A monolith is a single deployable application containing all the functionality - all the code runs together in one process and deploys as one unit. Its strengths are real and often underrated: it’s simple to develop, test, and deploy early on; calls between components are fast in-process function calls with no network; there are no distributed-systems problems to solve; and reasoning about the whole system is easier because it’s in one place. Its weaknesses appear at scale: the whole thing must be deployed together (a small change redeploys everything), teams working in the same codebase can step on each other, you can’t scale one part independently, and a failure or memory leak in one area can affect the whole. For many applications - and especially early on - a well-structured monolith is the right, simpler choice.
1.3 Microservices
Microservices split the application into many small services, each owning a specific capability, running in its own process, and deployable independently. The benefits address the monolith’s scaling weaknesses: each service can be deployed independently (so teams release without coordinating a single big deploy), scaled independently (scale only the parts under load), and developed by autonomous teams owning their service; a failure can be isolated to one service; and each service can even use the technology best suited to it. But these benefits come at a significant cost - the cost of becoming a distributed system - which is the crux of the trade-off and the part inexperienced engineers underestimate.
flowchart TB
subgraph Mono[Monolith - one deployable]
M[All capabilities in one process\nsimple, fast in-process calls, no distribution]
end
subgraph Micro[Microservices - many deployables]
S1[Payments] --- S2[Accounts] --- S3[Notifications]
Note[Independent deploy/scale/teams\nBUT network, consistency, ops complexity]
end
Mono -->|scale/team pressure justifies it| Micro 1.4 The Real Trade-Off
The honest framing is that microservices trade simplicity for independence, and you pay for that independence with distributed-systems complexity: network calls that can fail and add latency, eventual consistency and distributed transactions instead of a single database’s ACID, harder testing and debugging across services, and real operational overhead running and observing many services. So microservices are worth it when the benefits - independent deployment and scaling, team autonomy, fault isolation - genuinely matter, which is typically at larger scale with multiple teams and parts that need to scale or evolve independently. For smaller systems or single teams, a well-structured monolith is usually the better choice because it avoids all that complexity. The senior instinct is to choose based on whether the independence is needed, not on hype - and often to start with a monolith and extract services as real need emerges.
1.5 The Modular Monolith Middle Ground
There’s a valuable middle path: a modular monolith - a single deployable that is internally well-structured into clear modules with strong boundaries, as if they were services, but running together. This gives much of the maintainability and clear ownership of microservices without the distributed-systems cost, and it makes later extraction into services straightforward if and when a module genuinely needs independent deployment or scaling. Many successful systems run as modular monoliths for a long time, extracting only the specific services that need independence. This reflects the mature view: don’t jump to microservices for their own sake; keep clean internal boundaries, and split out services only when the benefit is real.
1.6 Banking Production Scenario
A bank runs its platform as a set of microservices where independence genuinely matters - payments, accounts, transfers, and notifications are separate services because different teams own them, they scale differently (payments handles far more load at peak), and isolating a failure in one from the others is valuable. Each is independently deployable, so teams release on their own cadence. But the bank is deliberate: a smaller internal tool that one team owns and that doesn’t need independent scaling runs as a well-structured modular monolith, because splitting it into services would add distributed complexity for no benefit. The bank chose microservices where the independence pays for its cost and kept simpler things simple - the deliberate, context-driven judgment rather than blanket adoption.
1.7 Troubleshooting: Wrong Architecture Choice
Architecture mismatches cause predictable pain. A team that adopted microservices without needing them suffers distributed complexity with none of the benefit - constant cross-service debugging, consistency headaches, and operational overhead for a system a monolith would have run simply; the remedy is to consolidate back or stop splitting further. A monolith that’s genuinely hitting the wall - teams blocked on one deploy pipeline, one part needing to scale independently, failures spreading - is a signal to extract specific services where the pain is, not to rewrite everything at once. Difficulty knowing where to split usually means domain boundaries aren’t clear (next chapters). The diagnostic question is always whether the system’s real pain is about needing independence (favouring services) or about accidental distributed complexity (favouring consolidation).
Monolith versus microservices - how do you decide, and what's the core trade-off?
The decision is a deliberate trade-off, not a fashion choice, and the mature answer is never a blanket “microservices are better.” A monolith is a single deployable application where all functionality runs together in one process. Its strengths are simplicity: it’s easy to develop, test, and deploy early on; calls between components are fast in-process calls with no network; there are no distributed-systems problems; and the whole system is easier to reason about because it’s in one place. Its weaknesses appear at scale - the whole thing deploys together so a small change redeploys everything, teams contend in one codebase, you can’t scale one part independently, and a failure in one area can affect the whole. Microservices split the application into many small, independently-deployable services each owning a capability, which addresses those weaknesses: each service deploys independently so teams release without coordinating one big deploy, scales independently so you scale only the parts under load, and is owned by an autonomous team; failures can be isolated to one service, and each can use technology suited to it. The core trade-off is that microservices buy independence at the cost of becoming a distributed system, and that cost is significant: network calls that can fail and add latency, eventual consistency and distributed transactions instead of a single database’s ACID guarantees, harder testing and debugging across services, and real operational overhead to run and observe many services. So I decide based on whether that independence is actually needed. Microservices are worth their cost when the benefits genuinely matter - typically at larger scale, with multiple teams, and with parts that need to scale or evolve independently - because there the independent deployment, independent scaling, team autonomy, and fault isolation outweigh the distributed complexity. For smaller systems or a single team, a well-structured monolith is usually better because it avoids all that complexity for benefits you wouldn’t use. I also value the middle ground of a modular monolith - one deployable with strong internal module boundaries - which gives much of the maintainability and clear ownership of services without the distributed cost, and makes later extraction easy when a module truly needs independence. So the senior approach is to choose based on whether the independence justifies the distributed-systems complexity, often starting with a well-structured monolith and extracting services only where real need emerges, rather than adopting microservices for their own sake and paying their substantial cost for no benefit.
Chapter Revision Notes
- Monolith: one deployable - simple to build/test/deploy, fast in-process calls, no distribution; but deploys as a unit and can’t scale parts independently.
- Microservices: many independently-deployable services - independent deploy/scale, team autonomy, fault isolation; but distributed-systems complexity.
- Core trade-off: microservices buy independence at the cost of network failures, eventual consistency, harder debugging, and operational overhead.
- Choose microservices when independence genuinely matters (scale, multiple teams, parts evolving separately); otherwise a monolith is simpler and better.
- The modular monolith is a strong middle ground; often start monolith and extract services only where real need emerges.