From Microservices to Modular Monoliths

Date Published: 10 July 2024

From Microservices to Modular Monoliths

What do you do when you find yourself in microservice hell? How do you keep the gains you (hopefully) made in breaking up your legacy ball of mud, without having to constantly contend with a massively distributed system? Migrate to a modular monolith.

Microservices

Microservices have been all the rage for the past several years. They offer a way to break up large, monolithic applications into smaller, more manageable pieces. This can make it easier to scale, deploy, and maintain your application. However, microservices come with their own set of challenges. They can be difficult to manage, especially as the number of services grows. They can also introduce latency and complexity into your system.

You know who really loves microservices? Cloud hosting companies like Microsoft, Amazon, and Google. They make a lot of money hosting microservices. They also make a lot of money selling you tools to manage your microservices. They make even more money when you have to scale up your microservices to handle the increased load on your system.

Who else? Consultants. They love microservices. They can charge you a lot of money to help you break up your monolith into microservices. They can charge you even more money to help you manage your microservices. They can charge you even more money to help you scale your microservices.

And let's not forget your developers. They love microservices. They get to work on lots of different services. They get to learn lots of different technologies. Most importantly, they get to practice Resume-Driven Development, as they happily add microservices experience to their CVs.

how are you with microservices?

Modular Monoliths

So what do you do when you find yourself in microservice hell? How do you keep the gains you (hopefully) made in breaking up your legacy ball of mud, without having to constantly contend with a massively distributed system?

It may be time to (re)consider the modular monolith.

A modular monolith is a monolithic application that is broken up into modules. Each module is responsible for a specific part of the application. Modules can communicate with each other through well-defined interfaces. This allows you to keep the benefits of a monolithic architecture, while still being able to break up your application into smaller, more manageable pieces.

modularity vs number of deployed applications

Yes, you'll still need to deal with some complexity inherent to modularity, such as ensuring modules remain independent while still being able to communicate with one another efficiently. But you'll avoid having to deal with the fallacies of distributed computing, such as network latency, bandwidth, and failure.

From Microservices to Modular Monoliths

Microservices to Modular Monoliths - From Zero to Hero

Migrating from microservices to a modular monolith is not a trivial task. It will require careful planning and execution.

I've authored a short course on Dometrain (where I also have two courses on building modular monoliths in .NET) that covers this topic in more detail. You can check it out here: From Microservices to Modular Monoliths.

Use code SUMMER24 to get 30% off until July 14th, 2024.

Keep Up With Me

If you're looking for more content from me in your inbox subscribe to my weekly tips newsletter and be sure to follow me on YouTube.

Steve Smith

About Ardalis

Software Architect

Steve is an experienced software architect and trainer, focusing on code quality and Domain-Driven Design with .NET.