6 Strategic Benefits of Microservices Architecture for Developers
Companies everywhere are switching to a microservices architecture to solve a few age-old problems in software development.
What is a Microservices Architecture?
Cloud architects and DevOps engineers strive to build a cloud-native architecture that is resilient, secure, and scalable – that’s unbreakable. Usually, when we think of the unbreakable, we think of something big. Like, well… a monolith. But as we’ll see, sometimes you have to think small to build big, resilient infrastructure.
To begin, let me say that there’s nothing wrong with monolithic architecture. For many types of applications, it works just fine. In particular, if you’re building a relatively simple or small-scale application, then a monolith is likely preferable. It’ll be easier to build, easier to reason about, and easier to scale. But as your application grows – and your team along with it – you’re going to run into more issues with a monolithic architecture. At some point, you’ll want to consider a microservices architecture to support your application’s growth. If you know from the outset that your application will be big, there’s a strong case for starting with a microservices architecture from the very beginning.
I’ll make the technical case for microservices a little later on, but first, let me explain to you how building an elephant is very much like building Facebook or Netflix.
Microservices Versus the Monolith
To use biological terms, if you were considering building an amoeba, it might make perfect sense to use a monolithic application– the architectural equivalent of a single-celled organism. To ensure your amoeba stays up, you might run several instances of the amoeba and load balance between them.
However, if you’re planning on building an elephant, the picture changes. You might be able to adapt the single-cellular architecture to a larger scale – after all, many sci-fi movies have done so – but you’d start to run into problems, not least of which is that it’s going to get costly to keep multiple single-celled elephants up and running.
This analogy from the animal kingdom might sound contrived, but I think it’s worth noting that in the biological world as well as the technological world, certain gravitational forces lead us in a particular direction. It’s no coincidence that the bodies of large, complex creatures are made up of billions of tiny semi-independent cells. This enables the elephant to sustain the loss of millions of cells (little microservices, if you will) due to injury or metabolic processes without it affecting the whole organism.
In technology, an optical illusion makes it look like our computers are getting smaller, but that’s merely their external form factor. In reality, our computing systems have gotten bigger and bigger, from room-filling mainframes with computing power less than a modern wearable to astoundingly complex cloud platforms whose underlying hardware fills dozens of datacenters.
This dramatic increase in scale has consistently required a corresponding distribution and decoupling. The mainframe was smaller than x86 because you could duplicate and load balance x86 hardware until the resulting array dwarfed the mainframe in most performance measures. X86 Servers were actually smaller than virtual machines because VMs abstracted the OS from its underlying hardware and made it portable and duplicable. Containers are actually bigger than VMs because you can now create and destroy them like cells and (in theory, at least) replicate them across regions and clouds.
And on it goes.
So in a way, microservices are a bigger, more stable architecture than a monolith. It’s yet another example of the smaller-to-grow-bigger progression we see all around us in the natural world and in the history of computing.
That is, in principle, why microservices are an effective architecture for large-scale systems. But what happens when fingers meet the keyboard? How does this elephant-inspired architecture fare in the development jungle?
6 Key Benefits of Microservices Architecture for Businesses
Here are what I believe to be the most compelling benefits of microservices for mid to large-scale applications:
- Team Sizes at Human Scale
Ever since Fred Brooks published The Mythical Man-Month in 1975, we’ve known that just adding resources to a complex software project doesn’t shorten the timeline to completion – and might extend it. You can’t measure software projects by “man-months” because communication and coordination between team members eat a greater proportion of time the larger the team grows. Therefore, the size and complexity of a monolith is limited by the effective size of a human team. On the other hand, microservices can be implemented independently by separate teams, with one team working on Service A while another works on Service B. This greatly increases the number of developers who can be effectively brought to bear on a particular application. The number of teams can multiply along with the number of microservices without creating an unwieldy communication overhead.
- Flexibility when Switching Languages
Languages have personalities and their own special superpowers. You might choose Erlang when building scalable, concurrent services like messaging but lean toward Python for data science and machine learning. If your application is a monolith, you’ll have to choose one language that best addresses your needs and accept its limitations. However, a microservices architecture allows you to pick the right language for the job since each service is independent. Teams can work with languages and frameworks most applicable to their domain.
An added advantage of this approach is that switching from one language to another (or even one implementation to another) is much simpler. Instead of rearchitecting the whole application, you can start with a single service and plug it back into the whole.
- Organized Architecture
If you lived in a warehouse with no rooms, closets, cabinets, drawers, or shelves, it would be hard to keep things tidy. You might impose organizational structures on all your items (shoes lined up here, books in neat piles, knives and forks always laid out in rows), but the lack of partitions would make creating and maintaining order very difficult.
A similar dynamic occurs within a monolithic architecture. The lack of natural partition and separation often results in tight coupling and/or ill-defined contracts between various application parts. Unless you’re really organized, it’s easy to get sloppy.
On the other hand, microservices tend to encourage well-defined contracts between services wherein the interaction between services is precise and discreet. This definition also tends to result in better documentation since the behavior of each service can be described exactly and comprehensively.
- Separate Scaling
The load your application experiences is not likely to be consistent across all features. New user registration may grow consistently and linearly, while comments and messaging may grow haphazardly but (some days) exponentially.
With a monolith, you have to scale your whole application to address the least common denominator. With microservices, you’re free to scale each independent service separately from every other service, so the resources your application consumes are directly proportionate to the load on each service. Why spend money on scaling everything when you can scale the pieces precisely?
- Enables Team Flexibility
A large-scale application may require the efforts of multiple teams working on multiple distinct problems. One team might be tasked with improving the user experience while another might be neck deep in algorithms attempting to improve performance. Yet another team might be addressing data privacy, user permissions, or supply chain vulnerabilities. In a monolith, all three teams would have to coordinate their efforts to release a new version of the application.
Since, in a microservices architecture, the three teams would be working on separate services, each team could choose its own cadence to enhance business functionality. One team might release new versions to production daily, while another might do so only once or twice a year. This allows each team to choose the rhythm most conducive to productive work on the problem the team is addressing.
- Less Regulatory Surface Area
Complying with regulations is becoming a greater and greater part of any development project – whether the scope of regulation is privacy, payment card processing, or accounting controls. Some regulatory frameworks involve the entire application, but many are only concerned with one or more particular services or sub-services.
In a monolith, it’s extremely difficult to limit the scope of regulatory scrutiny to only applicable services – meaning developers have to certify all the services of the application to get a particular feature to pass an audit. This broad regulatory scope within a monolith also means that multiple (potentially conflicting) regulatory frameworks (PCI, SOC2, HIPAA, etc.) may have to be applied system-wide.
In contrast, with a microservices architecture, only those services subject to the particular regulatory framework in question need to be certified. Additionally, if one regulatory framework applies to Service A and another to Service B, the team developing each service can focus on the regulatory requirements that apply to their domain.
Learn More about Microservices Architecture
The list of microservices architecture advantages goes on, but most of them (like the ones listed above) come down to the fact that moving to microservices is a way to break apart a complex application, so it’s easier for an individual or a small team to reason about and make changes to.
It’s an elegant solution to a significant problem in software development and in nature itself – how do you build scale without introducing fragility and inefficiency? How do you develop complex systems and ecosystems while balancing the jungle of details?
It should be noted that software development is significantly behind the natural world in the sophistication of our solutions. Moving to microservices solves one set of problems, but it introduces several more, some of which threaten to undermine everything we hoped to gain by moving to microservices in the first place. I’ll discuss some of these unintended consequences in later articles.
Frequently Asked Questions
What Problems Do Microservices Solve?
More and more companies favor microservices because of the flexibility and efficiency they offer. They fix problems inherent in a monolithic architecture like limited scalability, outdated technology, slower development cycles and the requirement to upgrade the entire system with each deployment. They allow companies to customize their architecture to their unique needs and specifications.
What Is The Best Language For Microservices?
The beauty of microservices architecture is that it eliminates the need to choose a single language. Microservices can be successfully utilized with a wide variety of different programming languages. However, some languages are particularly favored by developers: