Back in the day, most applications were conceived and developed as monoliths. All of the application’s functionality was part of a single, inseparable unit. Many web applications are still developed in this way, especially in the enterprise, but, aided by cloud technology, some companies are embracing the benefits of a microservice architecture — with Netflix being a leading example.
A microservice architecture consists of multiple small, discrete units of functionality that communicate with each other via simple APIs. Microservice architectures have some unique benefits — and some unique drawbacks — when compared to monolithic design paradigms.
Small Easily Understood Codebases
Each service of a modular architecture is relatively easy to understand for developers, which is not the case for large monolithic applications that can comprise millions of lines of code. Excessive complexity built up over years — and sometimes over decades — is a hindrance to change, and therefore a hindrance to business development.
Easy To Modify
Because each service makes available a stable API, it’s possible to change almost everything about the underlying implementation without breaking the application as a whole. If the API is stable, the internals of each module can be changed.
Of course, the APIs can develop too, but the important point here is that developers are not constrained by the continual worry that making a tweak in one part of the application will cause hard-to-fix regressions in other parts.
Change With Changing Technology
There’s a reason COBOL developers still make big money. Banks and other enterprises that built business-critical monolithic applications are hamstrung by legacy technology. They can’t upgrade to more modern technology in case the whole house of cards comes tumbling down. With a microservice architecture, the individual modules can be swapped out relatively easily, and it doesn’t matter whether they’re coded in COBOL, Scheme, Python, Node, or whether they use a different framework.
Microservice architectures help prevent technical debt.
Microservice architectures work particularly well with cloud platforms (and containers). Scaling monolithic applications is a headache, but it’s comparatively straightforward to spin up new cloud servers and deploy instances of service components on them.
A well-designed microservice architecture is much more resilient to failure than a monolithic design. A geographically distributed microservice application may experience local failures, but failures of isolated modules won’t degrade the system as a whole, and with cloud fallbacks in place, disruption can be kept to a minimum.
Of course, it’s not all wine and roses with microservice architectures, they have unique problems of their own. Although the complexity of individual components is reduced, the overall complexity of the system — including orchestration — may be increased. And then there’s the problem of ensuring that each module can communicate with the lowest possible latency with other parts of the application, something that’s is difficult to guarantee.
However, microservice architectures have benefits for large-scale cloud-deployed applications that make them the superior choice in many cases.