Microservices architecture embraces small, self-contained services built, deployed and scaled independently. However, despite the allure of microservices architecture, the monolith is still relevant.
Enterprises need to find a middle ground between microservices and the monolith. A good strategy is to create a hybrid microservices architecture.
What is a hybrid microservices architecture?
To adopt a microservices architecture, enterprises refactor an application to distribute services individually. A hybrid microservices architecture typically contains monolithic application code alongside a collection of scalable, platform-agnostic business components that suit cloud-native, containerized deployment. This approach combines the features of both monolithic and microservices architectures -- some parts of the application are built like microservices, and the remaining parts continue to operate in an expected and well-understood way.
Teams that create a hybrid microservices architecture can reap the benefits of distribution without having the need to refactor an entire monolith, saving a huge investment of time and resources, and preventing potential disruption to the app's performance and functionality.
How to implement a hybrid microservices architecture
A hybrid microservices architecture means implementing microservices only where they provide a benefit:
- Reusable components that have value across the app portfolio;
- Components that need flexible scalability; and
- Features that undergo frequent updates.
The first step in this journey is to split an existing monolith into logical and business components, and determine what components are common or reusable. Analyze the business benefits of using a combination of the two architectural styles in the same application, and decipher which components the software team can still build and deploy as a monolith.
Because microservices offer scalability as a primary benefit, identify the parts of the application that are easier to scale than others. Study the resource consumption of each module. For instance, if your application is designed for multiple concurrent users, you might want to consider making security a separate microservice to scale it according to expected workloads and how much data there is to protect.
The other important factor to consider is how often you update a service or component. A good reason to use microservices architecture is to enable frequent updates without disturbing the other parts of the application. Facilitating these seamless updates often means designing applications for a microservices architecture. On the other hand, data access components of the application may not require -- or even benefit from -- frequent upgrades. In this case, you can keep a monolithic codebase while the other parts of the application are converted to distributed services.
You might have thought about moving an existing monolithic application to microservices. However, you won't be able to convert a monolith to a microservice quickly or easily. There's a good chance you don't have the right technologies and tools, resources and developer expertise already in place. Take the hybrid approach and only use microservices when it is required -- not just for the sake of using it.