Monolith or Microservices: One App or Many?

Monolith or Microservices: One App or Many?

calendar_today ago • schedule2 min read
— Originally published at dev.to

As someone who’s still fairly new to the software industry, I’ve heard a lot of people throw terms like “Monoliths” and “Microservices” left and right. Truth be told, I’ve mostly pretended to know what these words mean, well, until now.

After spending some time on Google and checking out a few well-written articles, I’ve decided to just write my take on it. Keep in mind, I’m not some expert, so I’m always open to constructive criticisms (not random hole poking) in my logic.

The Monolith

Monolithic architecture is pretty much a traditional approach to software development where the entire application is built as a single unified program. Every part of the application, whether it’s the UI, the business logic, or database access, is written within one codebase.

Based on what I’ve learned, this means the different parts of the application are tightly coupled and typically deployed as one unit. While mixing multiple frameworks or languages is technically possible, doing so can introduce much complexity.

Then There's Microservices

If monoliths mean joining everything in one codebase, microservices seem to be the exact opposite. The large application is broken into small, independent services that communicate over a network (APIs, I believe). Each service handles a specific task, which may be processing payments, sending notifications, or simply authentication.

As services are independent units that simply communicate, they can be written in different languages, depending on their use. For instance, using Python for a service that requires a decent amount of data manipulation and Node.js for a real-time chat service. Plus, if one service fails, the others keep functioning, rather than taking every part of the app down alongside it.

What’s The Catch?

If either one of these approaches was perfect, there wouldn’t be much debate between the two. Whether you go for monoliths or microservices, there are a few downsides to consider.

With monoliths, scaling can eventually become inefficient. Horizontal scaling requires cloning the entire application stack instead of just the limited features, which wastes server resources. Changing the framework or programming language is also nearly impossible once a monolith reaches a massive size. Furthermore, working in one codebase can easily become a nightmare as the engineering team grows, leading to constant git merge conflicts, slow build times, and a slow development cycle.

When it comes to microservices, you get far more complexity in terms of infrastructure. You may need container orchestration (e.g., with tools like Kubernetes), service meshes, and automated CI/CD pipelines. Besides that, you have to consider network latency, connectivity issues, and securing connections, as various services need to communicate to run the application.

Don't Overengineer It

I have quickly become what I call an “expert” in the whole “Monolith vs. Microservices” debate, and here’s my take: Don’t overengineer it. The best software development approach depends on your current needs. If you’re building some kind of MVP or startup project, then just stick to a monolithic architecture, as it is modular and supports rapid early development and simple deployment.

On the other hand, if you’re scaling an enterprise application, with large distributed teams across several domains, microservices may make more sense. You get the fault isolation, independent scaling capability, and much more flexibility.

At the end of the day, there’s no universal winner here. Start with what solves your current problem, and let your architecture change as the problem gets bigger.

3 Comments

1 vote
1 vote
1
🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

TypeScript Complexity Has Finally Reached the Point of Total Absurdity

Karol Modelski - Apr 23

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Frameworks Are Institutional Memory

Ken W. Algerverified - Sep 17

Your Tech Stack Isn’t Your Ceiling. Your Story Is

Karol Modelski - Apr 9

Sovereign Intelligence: The Complete 25,000 Word Blueprint (Download)

Pocket Portfolio - Apr 1
chevron_left
132 Points • 3 Badges
1Posts
2Comments
Future 10x software engineer. Currently focused on full-stack web development. I enjoy meeting other... Show more

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!