The concept of microservices, an approach to designing a software application as a set of small services, has been around since at least 2015.
Delivering benefits such as the independent deployability and scalability of components, microservices are all the rage today. This is because these microservices benefits translate into incredibly faster software development speeds. With consumers being quick to change their preferences and behaviors, microservices adopters are able to keep up. Life is now great, they say.
As much as 56% of companies participating in a recent IMB survey plan to adopt a microservices approach in the next 24 months. Almost 80% of current users say their business will likely step up investment in microservices.
Microservices advantages have prompted Netflix, Amazon, eBay, Twitter, and many other tech giants to migrate from monolithic to microservices architecture.
But should your company use microservices?
It depends on the context and if microservices pros outweigh the cons for your application.
This blog provides an overview of a microservices vs. monolithic approach and five key benefits of using a microservices architecture. It also shares some of ITRex’s microservices experience and offers tips on when business should (not) use microservices. Dive in.
What is a microservices architecture?
A microservices style is an approach to developing cloud-native software applications as a suite of small components, or services, which are designed around a single business workflow and work together. Essentially, microservices are part of a fundamental shift to DevOps, a culture in which development and IT operations teams cooperate closely together using automation tools to deliver faster.
For instance, a microservices-based e-commerce application might have independent services responsible for product images, user profile management, search, inventory verification, payment processing, and shipping. The front end (the customer-facing side of the website) is decoupled from the back end (the business-facing side) so that it’s possible to customize and manage them separately.
If you take an example of Amazon, a microservices architecture might look overwhelming, if not terrifying.
Amazon Deathstar. Source
However, without using a microservices architecture, Amazon would have hardly evolved into one of the most valuable companies in the world (valued by a market cap of $1.694 trillion as of December 2021). The decision to leverage the benefits of microservices was made back in the early 2000s when Amazon understood that it was failing to scale at the speed of customer base growth because of slow development and coding issues.
Netflix woke up to the benefits of a cloud-based microservices architecture in the late 2000s after it was unable to mail DVDs to customers for a few days due to a massive database corruption. After breaking their application into over 700 microservices, Netflix engineers are able today to deploy code thousands of times per day, allowing the company to stream around 250 million hours of content daily to more than 200 million members worldwide.
What architecture did these tech stars and many other companies use previously, in pre-cloud days?
They used monoliths.
What is a monolithic architecture?
A monolithic application is built as a single unit that combines all components, including a client-side user interface, server-side operations, and a database.
Typically, a monolithic architecture:
An e-commerce application developed using a monolithic approach would consist of tightly coupled front-end and back-end services deployed as one unit, meaning that any customizations would need changes in the codebase and the front-end platform (see the diagram below for comparison).
Monolithic applications are far from dead. Actually, they still can be a good choice because they are often easier and cheaper to build (at least in their early days).
However, they come with drawbacks. A change in one part, whether for upgrading or scaling purposes, often requires rebuilding and redeploying the entire system. Likewise, the entire system can be brought down by one misbehaving part, meaning monoliths are fragile. Monoliths are also difficult to maintain as they grow, and integration with third-party tools is no joy either.
These drawbacks are hard to ignore in today’s disruptive market environment in which businesses should react rapidly to changes to survive and thrive. Hence the buzz about the benefits of microservices that are built by DevOps teams.
1. Independent deployment
This is perhaps the most important advantage of microservices, at least according to Sam Newman, one of the early pioneers of microservices. Making changes to an application to improve performance or add a new feature in response to emerging user needs is a breeze with self-contained microservices. Each service can be modified and upgraded without touching the entire system. They can be scaled independently from one another as well if one feature is under too much load because of excess requests. For instance, you can scale only your payment processing service if you are receiving more payments, without ramping up resource consumption by other services. This way the process requires less infrastructure and leads to cost savings.
2. Lower blast radius of failure
The loose coupling of a microservices architecture also provides another advantage of microservices — better resilience. Clear boundaries between the services, coupled with their micro size, limit the impact of new releases and ensure fault isolation. A failure in one service does not take down unrelated functionality, with the rest of the system remaining intact and continuing to provide services to users.
3. Data isolation
This is a third benefit that microservices deliver if done correctly. Data sovereignty per component is an essential feature of microservices. A microservices architecture makes it possible to clearly delineate services that touch data, which is critical, especially if the organization needs to comply with healthcare data regulations or the GDPR.
4. Use of the right technology
As monolithic applications have a single codebase, it is difficult to customize a tech approach for each functionality and a compromise is often sought. Microservices, in contrast, are designed around business capabilities by default, allowing teams to choose the best available technology for a particular functionality to make the most of it. This is because microservices can use different technologies or programming languages for different components. Microservices also simplify adopting the latest technology or integrating with third-party tools as needed.
The absence of vendor lock-in is another microservices advantage naturally stemming from its loosely coupled architecture.
The microservices approach enables companies to set up small, cross-functional teams around one service or a suite of services which can operate in an agile fashion. This model minimizes handoffs when one team needs to wait for another to complete their task, be it deployment or testing, before they can start their work. With no dependence on another team, the speed of development accelerates.
Adopters are reporting multiple benefits of using microservices, according to the IMB survey of 1,200 IT executives and developers. The most important microservices advantages they’ve felt include:
30% - Higher customer satisfaction
29% - Better security of company/customer data
29% - Faster time to market
28% - Improved application performance
27% - Greater flexibility to scale resources up or down
26% - Improved employee productivity
Are there any challenges with microservices? Well, as a popular quote goes, microservices are not a free lunch. Read on.
The inherent complexity of microservices increases with the number of services. This complexity is multifold and attributed to the following:
Microservices give companies more options to earn money but not save it. Apart from the cost of hiring developers capable of building a complex microservices environment, there are cloud and APIs bills. The good news is, ongoing costs can be significantly optimized as microservices use on-demand resources on a pay-as-you-go basis.
3. Security risks
Half of the respondents in the IBM survey cited security among the top challenges that they faced on their microservices adoption journey. Security needs to be baked in from the beginning as each microservice has its own set of entry points to communicate with others via various infrastructure levels, leading to increased application exposure to attacks. Besides, scaling infrastructure amplifies the risk of losing control and visibility of application components.
And finally, our last question: when microservices architecture is worth the hassle?
While the buzz behind microservices as a natural fit for cloud-native applications is all warranted, they shouldn’t be your default style. The literature puts it simply: start with a monolith and split it up when you run into scalability or resource consumption issues, or anything else that justifies taking the microservices path.
Here are our key tips when NOT to use microservices:
1. If you are a startup, microservices are a bad idea. It will be wiser to start with a monolithic application and break it into smaller components when it becomes too tricky for a two-pizza team. What you want is to run cheap experiments rather than investing loads of time, effort, and money into building out a complex architecture for a product whose customer value is yet to be validated. Monoliths are a perfect way to test out (and discard) MVPs to learn fast what will bring value to your customers.
As Martin Fowler, another well-respected microservices guru, says: i) Almost all the successful microservice stories have started with a monolith that got too big and was broken up. ii) Almost all the cases where I’ve heard of a system that was built as a microservice system from scratch, it has ended up in serious trouble.
Note: If the product domain is uncertain, you shouldn’t use microservices either when you are getting started. It might be just too early to leap into complex architectural decisions, and chances are your approach to setting up communications and boundaries will be way off the mark when your project matures.
2. Microservices are not a great choice for a solution that is not complex and can be maintained by a relatively small team. Rolling out a complex microservices architecture for your company’s event scheduling tool might indeed amuse your developers, but will it be worth all the trouble? Microservices are in the first place designed to address one problem: complexity. As Martin Fowler states, "don't even consider microservices unless you have a system that's too complex to manage as a monolith."
3. Don’t go for microservices if your application is too small to justify them. Do your inventory management or purchasing systems need to be converted to microservices if they are doing perfectly well what they should as they are? Once again, the idea of using microservices is to break a complex application into a set of smaller services. Decomposing a code that is already small and straightforward would only have the effect of adding complexity — now you have to navigate all deployment, interoperability, and debugging issues with a multitude of artifacts instead of deploying the entire unit in a good old-fashioned way.
OK then, but when to use microservices to reap their benefits?
Microservices make sense when any of the statements above is false. In other words:
A fair, real-life example from the ITRex portfolio would be an in-house cybersecurity tool that the client wanted to convert into a Security-as-a-Service platform. Microservices was a natural fit for this project because a monolithic architecture just can’t provide the scalability a SaaS solution needs to serve the growing number of customers, or flexibility to evolve and stay ahead of hackers.
Another illustrative project was an AI-powered big data platform for a global retailer. Our client wanted a cloud-agnostic solution built from the ground up. It was clear from the beginning that the platform would handle tons of data and should be designed as scalable to cater for new data sources to be added in the future. We also had to factor in the need to build communications with multiple external services. So realizing the benefits of microservices in this project was a natural strategy as well. The microservices architecture enabled us to smoothly roll out this complex system, using Kubernetes for orchestrating microservices and APIs.
And there was an AI-powered fitness mirror equipped with 3D cameras and an ML model which came with IoT sensors attached to the user’s equipment. Its major components, including an admin panel, an Android app, and a rules management system, had been built by different teams at different stages of the project, each using a different code and architecture. When the complexity of handling them all became overwhelming, we understood that we needed to build one backend for centralized management. And we converted them into microservices, redesigning their code and creating new databases. There were other benefits of using a microservices approach, like avoiding duplicate code or functionalities.
So, in our experience, it is preferable to use microservices when you need to manage growing data volumes, handle interoperation complexities, or ensure that your system is flexible enough to evolve with the business.
The microservices revolution is unfolding as companies are realizing microservices advantages to get an edge in the market.
The benefits of microservices allow organizations to be nimble and agile amid disruption that has become the new normal. Being able to deploy better software, faster makes them ready for anything that comes next after “what’s next.”
Before following suit, it’s just important that you know what microservices benefits can be available to your company and whether the hassle will be justified. Other than that, microservices can do wonders.
Still confused if your company should fall for the benefits of microservices? Get in touch with ITRex consultants. We will help you figure it out.