What Is Monolithic Architecture and Why Does It Matter?
Understanding Monolithic Architecture in Five Minutes
Table of contents
What does Monolithic Mean
So, you want to learn about monolithic architecture? Let's dive in.
Before we understand what monolithic architecture means, let's grasp the term monolithic. The term mono means one or single, and lithic means rock or stone. So, when combined, mono + lithic equals single + stone.
Architecture is about the processes and designs needed to build something.
Now that we know the inner meaning of monolithic and architecture, let's understand what monolithic architecture is.
What is Monolithic Architecture
In simple terms, monolithic architecture is a software design pattern with a large, tightly-coupled, single, unified codebase. It includes all the software components - user interface, business logic, and data access layer - in one place, independent from other applications.
To put it simply, monolithic architecture has all its code in one place, probably deployed in a single location. This is also called centralized systems. Hope that clarifies it.
Advantages of Monolithic Architecture
Easy to Start - It's easy to begin development at the early stage of production.
Low Latency and Faster - As all the code resides in a single codebase and is probably deployed in a single place, monolithic architecture does not consume in-between network calls like microservices to produce a response. It only consumes the initial network delay and the computational delay (server-side delay) - hence faster than microservices architecture.
Easy to Secure - it's easy to secure a monolithic architecture codebase as the entire project's codebase resides as a single entity.
Easy to Understand - Monolithic architecture gives a clear picture of the overall system as all the code is in the same place.
Easy to Test - Testing the entire system is easy due to the tightly coupled codebase. (Tightly Coupled - All code in a single place with the same language and framework)
Disadvantages of Monolithic Architecture
Single Point Of Failure (SPOF) - This is the biggest threat in monolithic architecture. As the entire codebase is a single entity and deployed at a single place, if any of the codebase produce any unforeseen bug, it may corrupt the entire system.
Reliability - If any part or any module is updated, the overall system needs to be updated; and if any new changes are introduced to the codebase, the entire system needs to be redeployed. This creates overhead to the agile software development process.
Lack of flexibility - Introducing new technology, different programming languages or frameworks is difficult. It will affect the entire system. The entire systems need to be updated with the new technology as monolithic architecture is tightly coupled.
Scalability - It's not possible to scale individual components in a monolithic architecture. If we need to scale only part of the codebase, we need to scale the entire codebase resulting waste of resources.
Not Highly Available - Monolithic architectures are not highly fault-tolerant hence they are not highly available. It might be difficult to maintain less downtime in a monolithic architecture.
When to Use Monolithic Architecture
Now that we understand the advantages and disadvantages of monolithic architecture, let's proceed to discuss its suitable and unsuitable scenarios. Below, I've highlighted the situations where considering monolithic architecture might be appropriate.
- Simple Functionality - If the project is simple, and does not require a multitude of complexities, the monolithic pattern is the best choice.
Early Stage - If the project is in the early stage, begin with the monolithic pattern. It would be easier to develop faster at this stage.
PoC and Quick Launch - For projects that need to be delivered at a limited time, the monolithic pattern would ensure its quick delivery.
No Microservices Knowhow - If the team does not have enough manpower to back microservices pattern development, go with the monolithic pattern - it is easy to develop.
Low Latency Application - For projects that need less latency and faster response, monolithic is the best choice. As monolithic systems are tightly coupled, the in-between network calls are minimized in monolithic architecture, unlike microservices.
Predictable Scale - If we can assure the project would have a predictable userbase - and there's no way the system would break for instance surge of requests resulting in downtime, we can consider the monolithic pattern.
When Not to Use Monolithic Architecture
These are the scenarios where we might consider microservices as the best choice.
High Availability - If high availability is an option for the system, the monolithic architecture does not offer high availability. The monolithic pattern is less available due to the Single Point of Failure. As microservices use multiple nodes, replication, and redundancy; they offer high availability of the system. Microservices also mitigate the problem of large downtime due to its characteristics of high availability.
Complex and Multitude of Functionalities - Some systems offer a multitude of functionalities to the users, and it is difficult to manage the entire codebase for all the functionalities in a single place. It's better to break the codebase into a modular approach and distribute it for an agile and faster development process.
Future Horizontal Scale - If the project is expected to gain gradual traction in its user base and needs to scale horizontally, microservices are the only choice. As monolithic has a single codebase and is deployed in a single place, we can not modularly deploy part of the monolithic codebase. But in microservices, we can deploy in a modular approach, and increase any number of nodes needed at any time to scale horizontally.
Who Uses Monolithic Architecture
Many companies still use monolithic architecture. eBay, Amazon, and Netflix are examples that initially started as monolithic codebases but later shifted towards microservices. Uber, Spotify, and Twitter are examples that use microservices architecture.
But if you wonder which big giants are still using monolithic architecture then wonder no more. SAP, IBM, and The Walt Disney Company are a few big names that still use monolithic architecture. However, all the legacy banking systems, governmental systems and most of the startups on the planet still use monolithic architecture.
The solution to the Problem of Monolithic Architecture
To solve these problems, microservices are an option. They offer solutions for SPOFs, fault tolerance, reliability, and scalability, and have better throughput than monolithic architecture.
Stay tuned for the next #SoSeries post on Microservices Architecture!
#systemdesign #monolithic