Decomposing Complex Applications
Learn how to scale applications by decomposing them by functionality and service.
So far, we’ve mainly focused our analysis on the X-axis of the scale cube. We saw how it represents the easiest and most immediate way to distribute the load and scale an application, also improving its availability. In the following section, we’re going to focus on the Y-axis of the scale cube, where applications are scaled by decomposing them by functionality and service. As we’ll learn, this technique allows us to scale not only the capacity of an application but also, most importantly, its complexity.
Monolithic architecture
The term monolithic might make us think of a system without modularity, where all the services of an application are interconnected and almost indistinguishable. However, this isn’t always the case. Often, monolithic systems have a highly modular architecture and a good level of decoupling between their internal components.
A perfect example is the Linux OS kernel, which is part of a category called monolithic kernels (in perfect opposition to its ecosystem and the Unix philosophy). Linux has thousands of services and modules that we can load and unload dynamically, even while the system is running. However, they all run in kernel mode, which means that a failure in any of them could bring the entire OS down. This approach is opposite to the microkernel architecture, where only the core services of the operating system run in kernel mode, while the rest run in user mode, usually each one with its own process. The main advantage of this approach is that a problem in any of these services would more likely cause it to crash in isolation, instead of affecting the stability of the entire system.
It’s remarkable how these design principles, which are more than 30 years old, can still be applied today and in totally different environments. Modern monolithic applications are comparable to monolithic kernels: if any of their components fail, the entire system is affected, which, translated into Node.js terms, means that all the services are part of the same code base and run in a single process (when not cloned).
The illustration below shows an example of monolithic architecture.
Get hands-on with 1400+ tech skills courses.