Making a case for Monolithic architecture

Sometimes small and boring design choices are better.

In the world of software development, products typically adopt one of two architectural approaches: monolithic or microservices/distributed architecture. These days, most teams seem inclined toward microservices, while those sticking to monolithic architectures often do so due to constraints like limited resources or time.

However, after thoroughly studying system design, I realized that the decision between the two architectures should be taken with much more intention and consideration of business constraints.

 

Microservices isn’t always the better choice

Microservices-based architectures are often regarded as “tech-heavy” and therefore superior from an engineering standpoint. But the choice between architectures isn’t purely a technical one — it’s also a business decision.

As software engineers, our primary job is to solve a business’s problems. This means our architectural decisions should account for constraints such as time-to-market, budget, target audience, infrastructure costs, and more.

You might be thinking, “I became a software engineer to write code, not deal with business decisions.”

Well, here’s the reality: writing code is just one part of the job.

The software development lifecycle involves several stages:

  1. Requirement gathering

  2. Defining the scope of the feature

  3. System design

  4. Development

  5. Testing

  6. Deployment

Writing code is just one-sixth of the process. System design, which is critical for choosing the right architecture, deserves special attention.

 

What is system design?

System design is the process of defining, creating, and organizing the architecture of various system components, interfaces, and modules. It involves determining how these elements will work together to meet the specific needs and requirements of a business.

 

Why and when to choose monolithic architecture?

There are several scenarios where monolithic architecture is the better choice, especially when:

  1. You’re just starting out or building a proof of concept (POC). Monolithic systems are simpler to build and manage with limited resources.

  2. Your resources are constrained. A monolithic architecture requires fewer resources to maintain, as everything resides in a single codebase.

  3. You need faster communication between components. Unlike distributed systems that rely on network-based communication, monolithic systems allow for process-to-process or function-to-function communication, reducing latency costs.

  4. Security is a priority. A tightly encapsulated system is inherently easier to secure since there are fewer moving parts.

  5. Testing needs to be straightforward. Integration testing is simpler because all modules are in one system, making it easier to perform end-to-end testing.

  6. The development team has limited experience. Monolithic systems are easier for less experienced developers to build, especially if standard application patterns are followed.

  7. Deployment needs to be quick and simple. Monolithic applications involve deploying a single file or directory, which is far easier compared to managing the deployment of multiple services.

  8. The user base is limited. For businesses with a small number of users or low traffic, monolithic systems are sufficient.

 

Long term reality

While monolithic architectures offer many advantages during the early stages of development, they come with significant limitations as businesses grow:

  1. Scaling is challenging. Monolithic systems are difficult to scale incrementally. Only the whole application can be scaled, which is inefficient.

  2. Tight coupling increases complexity. Components are closely linked, making it harder to implement changes or isolate issues without risking system-wide disruptions.

  3. Development slows down. Any code change can impact the entire application, necessitating thorough coordination and testing, which makes the development cycle longer and tedious.

In the long run, most businesses eventually transition to microservices-based architectures. Microservices allow for better scalability, easier independent component updates, and faster development cycles once the system is established. However, adopting microservices too early can be costly and unnecessarily complex for small-scale systems.

The key takeaway is to choose monolithic architecture when your business is small, your resources are limited, or your primary focus is rapid development and deployment. As your business grows, the natural progression toward microservices becomes inevitable to address the challenges of scaling and complexity. By recognizing when to make this shift, you can optimize your resources and align your architecture with your business needs, avoiding the pitfalls of over-engineering.

Previous
Previous

A Philosophy of Craft: Abstractions and Entropy in Software Engineering

Next
Next

Michael Jackson game on m68k CISC microprocessor