Today, Microservices are one of the hottest trends in the Application Development space. A recent report 'Microservices Adoption in 2020' by O’Reilly states that 77% of respondents have adopted Microservices, with 92% experiencing success with Microservices. 49% of them report being at least “mostly successful” and 10% report that Microservices development efforts were a “complete success”. With more cloud adoption, decentralization, and successful API integration, it’s safe to assume that Microservices adoption will continue to grow.
As Microservices bring a fundamental shift in the way applications are designed and developed, it’s helpful to explore how Microservices are implemented. Let us get started.
The Strangler Pattern – Martin Fowler first discussed this pattern in 2004. The name derives its roots from Strangler Fig trees. In the Strangler pattern, teams replace existing legacy systems by building new services incrementally in a phased manner.
It is advisable to start with features/components with good test coverage and less technical debt, teams can also start with frequently deployed features. As a starting point, keep it safe and select a simple component. As the team progresses with incremental development and the entire application is recreated using microservices, legacy systems are put to retirement.
The Strangler pattern consists of three phases:
- Transform/Modernize the existing application by creating new versions of existing services.
- Co-existence of monolithic with Microservices.
- Replace monolithic applications once the entire microservices architecture is up and running.
Benefits and Drawbacks
The Strangler Pattern helps in moving to Microservices in a systematic and phased manner. In this pattern, teams can do proper application architecture planning. Teams can choose the high value, repeat deployable features based on business requirements. The other major advantage is Roll-Back Strategy, if new features do not function as required, they can be rolled back and monolithic can function in the backend without hampering business operations or end-user experience.
Although this approach is interesting, it presents few challenges. Advancing towards Microservices requires a strong combination of technical workforce, processes, and tools. Teams need manpower that can understand both systems and make them work properly. As two systems are existing parallelly and need to communicate with each other, the communication and integrations must be well-planned.
The Lego Pattern – As the name suggests, the Lego pattern entails building on top of existing Monolithic services. Think of Lego Pattern as real Lego blocks, these Lego blocks come as well-defined structures (without any need of designing and building them). One can use these blocks to create huge structures by stacking one Lego over another. Similarly, by using Lego Pattern, teams build new features and services on top of Monolithic.
This pattern gives rise to a Hybrid Architecture – As Monolithic continues to exist and new features are developed using Microservices.
Benefits and Drawbacks
Using this approach, software developers can speed up building new features or applications. The other benefit of using the Lego pattern is reduced technical debt with the introduction of Microservices. It helps businesses to start their transformation journey right away.
The major challenge is establishing efficient communication while taking care of latency and speed penalties. As developers build services using the Lego pattern, they need to put a lot of time gluing different services and tools. Another drawback of this pattern is that the existing technical debt in Monolithic remains the same.
The Nuclear Pattern – The Nuclear Pattern involves rewriting the entire Monolithic application in a Microservices way. The old Monolithic would remain alive with fixes, patches, and a team to run and maintain, while the transition is happening. The Nuclear Pattern gives rise to “Second System” running parallel to the “In-Process Microservices” until the new architecture is ready for deployment.
Benefits and Drawbacks
The most important benefit of adopting Nuclear Pattern is zero technical debt and a complete transition to agile and modern ways of application development.
The biggest drawback of this pattern is the time taken to rewrite the application from scratch. Another challenge is rewriting the application requires a completely new set of skills and hence organizations spend a lot of time, money, and effort in hiring the right talent. Moreover, the nuclear pattern involves an inherent risk of having unforeseen issues because the final performance of the application can only be known once the deployment is done.
Designing a Microservice
The foundation of a comprehensive Microservice solution is the ability to define all microservices within clear boundaries and aligning them with business requirements. A key element of Microservice design is understanding that each microservice should be dedicated to one specific function or feature.
Consider the following aspects while designing a Microservice:
Communication – Microservices architecture is unique in a way, they are a collection of numerous services, each running its functions and instrumented together to interact with each other. This requires them to communicate with each other at the right time, and hence communication is important.
Microservices can communicate in two ways: Synchronous and Asynchronous. To understand how they work, just follow the formation of these two words: Synchronous Communication works in a coordinated and patterned way. For example, a customer added items to the shopping cart (Shopping Cart is a microservice), this will lead to creating a chain of dependencies and various services are being called one after the another like Applying Discounts, Payment, and Inventory. This can often lead to speed issues and errors in case any of the services become unavailable. Asynchronous Communication works independently. The services are independent of each other and handle communication separately.
Integration – A smooth integration among Microservices ensure a seamless end-user experience. Microservices support API, Message, and File Transfer way of integration style.
The API style of Integration is synchronous and triggers subsequent responses.
Messaging Style works via a common messaging system. The messaging system is used to exchange data or pass on messages in a pre-defined format. This type of integration can handle high-volume spikes. File Transfer Integration works by exporting source applications to a file system in CSV format and then getting them processed by the target system. This type of integration works when loads of data need transfer and execution at pre-defined times.
- Deployment – Choosing the right deployment strategies to help organizations to attain higher agility, flexibility, scalability, and efficiency. There are different Microservices deployment strategies that teams can use – Multiple Service Instance Per Host, Service Instance Per Host, Service Instance Per Container, and Server-Less Deployment.
When to choose what?
Microservices are a huge success but the way to implement, manage, secure and scale them can be complex. This has created an increased challenge of starting on the wrong foot. This challenge can be resolved by considering these questions:
- How important is it to transform the monolithic and how long it can withstand the daily performance pressures created by a new way of operations and business requirements?
- Is it possible for Monolithic applications to fulfill existing operations and security processes to deliver outcomes in a distributed workforce environment without any changes?
- How do we create effective working relationships while transitioning to Microservices?
- Can we keep monolithic applications routinely updated, patched, and operating effectively without impacting business?
- Microservices come with a lot of management and testing challenges. Are you ready to take up these challenges?
- What will be the mode of integration, communication, and deployment?
Once you have answers to these questions, approach the whole plan with radical thinking of how to transform monoliths and move ahead in the application development journey.
As a point in case, if you have a monolithic application with huge technical debt and limited manpower to maintain legacy code, and limited scalable opportunities, you should think of the Strangler Pattern to modernize it.
However, it is not necessary to always rip and replace the monoliths. Point in case, if your monoliths are time-tested and reliable, it’s not necessary to rewrite them from scratch. That’s where the Lego Pattern can be useful. It helps you adopt all agile ways of software development while keeping your time-tested legacy in place.
If your monoliths are posing serious business challenges, it’s time to adopt Nuclear Pattern and rebuild them from scratch.
For any organization, Microservices are an evolving concept. They deliver meaningful outcomes for organizations to gain agility and control over their applications in a new business environment.
Microservices for your future applications
Microservices help Application Development teams to ensure secure and stable operations. As you have been wrestling with the strategies to implement and adopt Microservices, these insights will help you in making an informed decision, adopt the right pattern and build a fundamentally fit microservices architecture for the future.
Qentelli helps clients to modernize their applications using the Microservices approach. We don’t believe in ripping and replacing monolithic in the name of transformation. Our rational approach will help you take the optimum advantage of your monolithic applications by either rewriting them from scratch or building new Microservices on top of it. Qentelli’s Application Modernization Services help clients in implementing and deploying Microservices using a combination of public, private, and hybrid cloud.