DATE Aug 07 2023 | READ 4 MIN

Monolith vs Microservices - When to use each

DOCUMENT
Cover image for Monolith vs Microservices - When to use each FEATURED ATTACHMENT

When we talk about software development, many doubts and discussions come up — like which programming language is better, which database to use, or even how to deploy the application. That’s normal.

The real problem is when people take sides and only see one perspective.

This happens a lot!

I was on Twitter and saw a big discussion thread about Which is better: monolith or microservices?

So, this article is to share my opinion on the topic.

The Beginning

Before this type of discussion existed, there was already a way to build applications, and that way is called Monolith.

Monolith was conceived first because, most of the time, it’s a simpler architecture (though that’s not always the case). Let’s understand what exactly a monolith project is:

Understanding a monolith

E-commerce Monolith Architecture

🖥️ Frontend
⚙️ Backend (API)
🗄️ Database

This is an example of an e-commerce application. To better explain what’s happening, we have this e-commerce split into three parts:

  • Frontend: what the end user sees and interacts with
  • Backend: where all the application logic lives
  • Database: where all the data and information of our e-commerce is stored

So, this is a single system with all modules and functionality within it. One project, one codebase, one database, one programming language!

Good Points

That singularity brings us many advantages:

BEFORE

Without Monolith

Scattered development without unified structure

  • Multiple codebases to manage
  • Different patterns in each service
  • Complex deployment orchestration
  • Technology fragmentation
AFTER

With Monolith

Unified development with consistent structure

  • Single repository, single codebase
  • Consistent patterns and logic
  • One deployment pipeline
  • Rapid development cycle

Monolith has a lot of good points.


Imagine that our e-commerce has all these functionalities:

E-commerce Features (All in One)

🔐 Auth
📦 Products
🛒 Cart
💳 Payments
🔔 Notifications
🚚 Shipping

It’s a great application, right? We have many functionalities coupled together, and this brings us to the first problem of monoliths…

Bad Points

As I said, all functionalities are highly coupled, which means that if one functionality breaks, all the others break too.

When Notifications Break...

1
💥
Notification Service Crashes

An unhandled exception occurs in the notifications module.

2
⚠️
Backend Goes Down

Since everything is in the same process, the entire backend crashes.

3
🚫
All Services Unavailable

Auth, Products, Cart, Payments, Shipping — everything stops working.

4
😱
Users Can't Access Anything

Complete service outage. Users see error pages everywhere.

In our example, the notification functionality had a problem, and because of it, the entire application is down.

Unfortunately, this isn’t the only problem with monolith applications…

BEFORE

Monolith Challenges

Issues that arise as the application grows

  • Scaling requires duplicating the entire app
  • Codebase grows exponentially
  • Single point of failure
  • Deployment = everything or nothing
AFTER

What You Need

Ideal characteristics for large-scale systems

  • Scale only what needs scaling
  • Smaller, manageable codebases
  • Isolated failures
  • Independent deployments

The Present

Looking at these problems, software architects wanted to find a better way to build software, so they came up with a solution.

The term “microservices” was coined in May 2011 during a software architects conference to represent a style of system architecture. The microservices-oriented architecture proposal is to develop systems that are more flexible, scalable, and simpler to maintain than monolithic architectures.

But the first question is: how exactly does it work?

Understanding microservices

In a microservices architecture, modules and functions are split apart. It’s as if each service is a standalone application. See the example below:

Microservices Architecture

🔐
Auth Service
Node.js + Redis
Own Database
📦
Products
Go + PostgreSQL
Own Database
🛒
Cart
Python + MongoDB
Own Database
💳
Payments
Java + MySQL
Own Database
🔔
Notifications
Rust + Kafka
Own Queue
🚚
Shipping
C# + SQL Server
Own Database

🐳 Each runs in its own container

🔀 Communicate via APIs/Events

📈 Scale independently

Notice how each service is completely independent:

  • Different technologies: Each team chooses what works best (Node, Go, Python, Java, Rust, C#)
  • Own database: No shared state between services
  • Isolated deployment: Deploy one without touching others

Observations

Microservices are occasionally misconstrued as Pattern-Oriented Software Architecture (POSA); however, it’s essential to recognize that they are distinct concepts.

The company RedHat says this about it:

The main characteristic that differentiates them is scope: SOA is an architectural approach adopted by the enterprise as a whole, while microservices are an implementation strategy of the development team for each application.

With that in mind, let’s continue.

Good Points

A major advantage of microservices architecture is that if one microservice stops, the entire application doesn’t break!

When Notifications Break in Microservices...

1
💥
Notification Service Crashes

The notifications microservice encounters an error.

2
Other Services Keep Running

Auth, Products, Cart, Payments — all continue working normally.

3
🛡️
Graceful Degradation

Users can still shop, pay, and use the app. Only notifications are delayed.

4
🔄
Easy Recovery

Ops team restarts just the notification service. No full redeploy needed.

Here we can see that if one of the microservices breaks, the others keep working. This is great because it brings us more consistency and reliability.

Microservices bring many benefits:

BEFORE

Monolith Limitations

What you're limited to with monolithic architecture

  • One massive codebase for everything
  • Complex code that's hard to understand
  • Deploy everything at once
  • Stuck with one programming language
AFTER

Microservices Benefits

What microservices architecture enables

  • Smaller, focused codebases
  • Each service is easy to understand
  • Deploy services independently
  • Use the best language for each service

As you can see, microservices have many advantages and are used to some extent by almost every large tech company nowadays, since they provide many capabilities for organizations to scale their systems properly.

Bad Points

Unfortunately, microservices aren’t perfect. This software architecture has problems, so let’s talk about some of them.

Microservices Complexity

1
🌐
Distributed System Challenges

Network calls can fail. Latency becomes a concern. Debugging across services is hard.

2
🔧
Deployment Overhead

Each service needs its own CI/CD pipeline, monitoring, and infrastructure.

3
🔄
Data Consistency

Keeping data in sync across services requires careful design (sagas, event sourcing).

4
💰
Increased Costs

More services = more servers, more monitoring, more operational complexity.

Microservices are usually complex. They need to be very well planned and executed because, if not, the software can become insecure, vulnerable, and hard to understand as a whole.

The truth is, microservices are excellent but can also be a shot in the foot.

The Future?

So, to finally answer the awaited question… Which is better?

In my opinion, it depends on the situation :)

BEFORE

Use Monolith When

Scenarios where monolith makes more sense

  • Small team (< 10 developers)
  • Simple business logic
  • MVP or early-stage startup
  • Limited budget for infrastructure
AFTER

Use Microservices When

Scenarios where microservices shine

  • Large team with multiple squads
  • Complex, evolving business rules
  • High scale requirements
  • Need for independent deployments

We, as developers, need to be smart when choosing one architecture over another. For example, it’s not smart to use microservices architecture for a website for a small local store because the development will be slower, the website probably won’t have complex business rules, and it will be more expensive.

Conclusion

It’s important to always be open-minded. Microservices have become mainstream in software development, but that doesn’t mean we should only use them. There are other types of software architecture like Component-Based Architecture, Service-Oriented Architecture (SOA), Layered Architecture, and others.

I think a good developer must understand when to use one or the other.


Contact me and tell me what you think about this article!

Hope you liked it.

END OF DOCUMENT