keepcalculator

06 Numbers and Powers

Monolith vs Microservices: How to Choose

Card No. 06·82753 · Updated · Standard formula, shown below

Choosing between monolithic and microservices architecture depends on your team size, expected traffic, and deployment needs; a monolith wins when your team is small, your domain is tightly coupled, or you need to launch quickly. This article explains the trade-offs and gives a practical decision framework so you can pick the right starting point and know when to evolve.

What the Two Architectures Actually Are

A monolith is a single deployable unit where all components (UI, business logic, data access) run as one process. A microservices architecture splits the system into small, independently deployable services that communicate over a network, usually via HTTP/REST or messaging. The key difference is not code size but deployment independence: microservices can be updated and scaled separately, while a monolith is built and deployed as one artifact.

Many teams start with a modular monolith—a single deployable unit with clear internal module boundaries—which gives some of the organizational benefits of microservices without the operational cost. This is often the best middle ground.

How a Monolith Wins

A monolith is often the pragmatic choice for the majority of projects. Here’s where it clearly beats microservices:

  • Speed to market: You can build, test, and deploy a monolith in days or weeks, not months. There is no need to set up service discovery, API gateways, or distributed tracing.
  • Simpler development: A single codebase makes it easier to refactor, debug, and onboard new developers. You don’t need to coordinate changes across services.
  • Lower operational overhead: One process means fewer moving parts, less monitoring, and simpler logging. You don’t need Kubernetes or a service mesh to start.
  • Better performance for tight coupling: If your features share a database or need transactional consistency, a monolith avoids the network latency and distributed transaction complexity of microservices.
  • Small teams: A team of 2-10 developers can efficiently work on a monolith. Microservices require at least one team per service to avoid coordination bottlenecks.

Real-world examples: many successful SaaS products (like Basecamp, Shopify’s early version, and even Netflix’s early days) started as monoliths. They only moved to microservices when their scale demanded it.

When Microservices Make Sense

Microservices are not a silver bullet. They are justified when you have:

  • Independent scaling: Different parts of your system have very different load profiles. For example, a recommendation engine might need 100 instances while the user profile service needs only 2.
  • Multiple teams with clear ownership: If you have 20+ developers organized into autonomous teams, microservices allow each team to deploy independently without waiting for others.
  • Polyglot needs: Some components may be better written in a different language or with a different database. Microservices allow that flexibility.
  • High availability requirements: If one service fails, the rest can keep running. In a monolith, a bug can take down the whole system.

But note: microservices introduce significant complexity—network latency, distributed transactions, eventual consistency, service discovery, observability, and DevOps maturity. Only adopt them when the benefits clearly outweigh these costs.

How to Choose: A Decision Framework

There is no one-size-fits-all answer, but you can ask yourself these questions:

  1. What is your team size? Fewer than 10 developers? Start with a monolith. More than 20? Consider microservices.
  2. What is your expected traffic? If you expect millions of users with variable load, microservices may help. If you’re building an internal tool or a niche product, a monolith is enough.
  3. How coupled is your domain? If your features share a lot of data (e.g., an e-commerce checkout), a monolith is simpler. If you have distinct bounded contexts (e.g., inventory, shipping, payments), microservices can work.
  4. What is your deployment frequency? If you deploy daily, a monolith is fine. If you need to deploy each component independently, microservices are better.
  5. What is your team’s experience? If your team has never run microservices, the learning curve will be steep. A monolith lets you ship first.

A common heuristic: start with a modular monolith. Keep clear module boundaries so you can later split into microservices if needed. This gives you the best of both worlds.

Common Problems with Each

Monolith problems:

  • Scaling is all-or-nothing: you must scale the entire application, even if only one feature is under load.
  • Deployments become risky as the codebase grows; a small change can break unrelated features.
  • Long-term maintainability suffers if the code is not well modularized.

Microservices problems:

  • Distributed systems are hard: network failures, latency, and partial failures are the norm.
  • Testing across services is complex; you need contract tests and integration environments.
  • Operational burden: you need containerization, orchestration, service mesh, and observability tools.
  • Data consistency: transactions span services, so you often need eventual consistency and sagas.

Cost and Complexity Comparison

The total cost of ownership (TCO) is often underestimated for microservices. You need:

  • Infrastructure: more servers, load balancers, and monitoring tools.
  • People: dedicated DevOps or SRE teams to manage the platform.
  • Development overhead: writing communication code, handling retries, and implementing distributed tracing.

A monolith, by contrast, can run on a single server or a simple PaaS. For many startups, the cost savings of a monolith in the first year can be significant. However, as you scale, the cost of a monolith in terms of lost agility and scaling inefficiency may outweigh the infrastructure savings.

Alternatives to Consider

Before jumping to microservices, consider these alternatives:

  • Modular monolith: Keep a single deployable unit but enforce strict module boundaries. This is often the best starting point.
  • Service-based architecture: A middle ground where you have a few coarse-grained services (like order, customer, inventory) rather than dozens of fine-grained ones.
  • Serverless functions: For event-driven or short-lived tasks, serverless can give you scale without managing servers, but it has its own constraints.
  • Event-driven architecture: Use messaging to decouple components, even within a monolith.

Each has trade-offs; the key is to match the architecture to your specific context, not to follow trends.

Frequently Asked Questions

Is a monolith always bad?

No. A monolith is often the best choice for small teams, simple domains, or early-stage products. Many successful companies run monoliths for years. The “monolith bad” narrative comes from large companies that hit scaling limits, but those limits are not relevant to most projects.

Can I migrate from monolith to microservices later?

Yes, but it’s not trivial. If you keep a modular monolith with clear boundaries, you can gradually extract services. The process is often called “strangler fig” pattern. Start with the most independent module and extract it, then iterate.

What is the difference between a monolith and a distributed monolith?

A distributed monolith is a system that is deployed as multiple services but still has tight coupling—for example, services that share a database or require synchronous calls to function. It has all the downsides of microservices (complexity) and none of the benefits (independent deployability). Avoid this.

How do I decide the number of microservices?

Start with the smallest number that makes sense. A good rule of thumb is to have one service per bounded context (a domain concept). If you’re unsure, start with 2-3 services and split later. More services mean more overhead.

What are the main costs of microservices?

Beyond infrastructure, the main costs are developer time (writing communication code, handling failures), operational tooling (Kubernetes, monitoring, tracing), and the cognitive load of debugging distributed systems. Many teams underestimate these costs.

Can a monolith scale?

Yes, a monolith can scale horizontally by running multiple instances behind a load balancer. You can also scale vertically by increasing server resources. The limitation is that you scale the whole application, not just the busy parts, which may be inefficient but is often acceptable.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →