TECHHAWKS

Approach

Monolith vs microservices: how to structure your software

A monolith is one application, deployed as one unit, that contains all of a system's features. Microservices split the same features into many small, separately deployed services that talk to each other over a network. The choice affects how quickly you can change things, what it costs to run, and how failures spread. It is often presented as old versus modern. In practice it is a question of scale, team size and how independently parts of the system need to change.

Option A

Monolith

In a monolith, every feature lives in one codebase and runs as one application, usually with one database. A well structured monolith is divided internally into clear modules, such as bookings, billing and reporting, but they are released together. It is simple to build, test, deploy and reason about, and for most business systems it stays the right shape for a long time.

Strengths

  • One codebase and one deployment to understand
  • Simple to test the whole system end to end
  • Fast calls between features, with no network in between
  • Lower hosting and operating cost
  • Changes that touch several features happen in one place

Trade offs

  • Every release ships the whole application
  • A badly structured monolith becomes tangled and slow to change
  • Parts of the system cannot scale separately
  • Large teams can get in each other's way in one codebase

Option B

Microservices

With microservices, the system is split into small services that each own one area, such as payments, notifications or search, with their own data and deployment. Teams can release their service without coordinating with everyone else, and busy parts can scale on their own. The price is a distributed system: network calls that can fail, data spread across services, and far more to monitor.

Strengths

  • Teams can release their own service independently
  • Busy parts of the system can scale on their own
  • A failure can be contained to one service if designed well
  • Each service can use the technology that suits it
  • Large organisations can split ownership cleanly

Trade offs

  • Much more infrastructure, monitoring and deployment work
  • Network calls between services add delay and new ways to fail
  • Keeping data consistent across services is hard
  • Testing and debugging span many moving parts
  • Higher running cost and more operational skill needed

Side by side

How they compare

FactorMonolithMicroservices
DeploymentOne application released as a unitMany services released independently
ComplexityLower, one thing to runHigher, a distributed system to run
Speed of change for a small teamFastSlowed by coordination and infrastructure
ScalingWhole application scales togetherEach service scales on its own
FailuresOne fault can affect the whole applicationCan be contained, if designed for it
Running costLowerHigher, with more services and tooling
Best suited toMost business systems and small to mid sized teamsLarge systems with many independent teams

When monolith is the right choice

A monolith is the right choice for almost every new business system and for most established ones. A portal, back office tool or CRM built by a small team changes fastest when everything is in one place and a release is a single step. Structure it well inside, with clear modules and boundaries, and it stays easy to work on as it grows. If one part later needs to stand alone, it can be separated then.

When microservices is the right choice

Microservices are the right choice when an organisation has several teams that need to release independently, parts of the system with very different load or reliability needs, or a monolith that has genuinely become a bottleneck for a large engineering group. They are an answer to organisational scale as much as technical scale. Without the team and the operational maturity to run them, they usually slow things down rather than speed them up.

Questions

Common questions

Will a monolith stop us scaling later?

Rarely. A monolith can run as several copies behind a load balancer, with a well tuned database and caching, and that carries a great deal of traffic. When one part does need to scale separately, such as document processing or a busy API, it can be moved into its own service at that point, based on real evidence rather than guesswork.

What is a modular monolith?

It is a single application organised internally into clearly separated modules, each with its own responsibilities and a defined way of talking to the others. You keep the simplicity of one deployment and one database, while gaining much of the clarity people want from microservices. If a module ever needs to become its own service, the boundary is already drawn, which makes the move far easier.

Is a monolith harder for a new team to take over?

Usually the opposite. One codebase with clear structure, tests and documentation is easier to learn than many services spread across repositories, each with its own deployment and configuration. What makes any system hard to take over is missing documentation, unclear structure and knowledge held in one person's head. Owning the code, infrastructure and documentation from day one matters more than the architecture style.

Tell us what needs building.

Thirty minutes with the engineers who would build it. Free, no commitment.

Book a call