Key strategies to help migrate to microservices
A migration to microservices is typically driven by flexibility, productivity and scalability demands. However, just because enterprises want these benefits, it doesn’t mean that their business, or IT teams, are ready for the change.
Get advice in the five articles featured here to determine if microservices adoption is right for your project, learn how to get teams ready for such an architecture, plan and execute the migration, and avoid common pitfalls.
Is your team ready to migrate to microservices?
While many have benefitted from a microservices architecture, that doesn’t mean it is a perfect fit everywhere. Two factors come into play: whether an application will succeed divided into microservices, and if the enterprise software team possesses abilities to create and manage them.
Teams face operation complexities when they go through a migration to microservices. Determine their readiness for the new architecture by evaluating standards for code reviews, CI/CD use, testing practices and other aspects of the code delivery workflow.
Joydip Kanjilal, software architect, proposes investment in these areas to tackle a microservices architecture: componentization, decentralized data management, infrastructure automation and resilient fault tolerance.
Flag any team processes that will not work with microservices. Consider restructuring Agile roles and responsibilities that focus on monolithic application development to work in the new setup.
Who does what on a microservices team?
After determining readiness for microservices architecture, the next step is to structure the development team to design and implement them. In this tip, Kanjilal stresses that a proper structure can help enterprises meet business and development goals faster and with more efficiency. But what type of team is right for you? Three appropriate microservices team structures are:
Conway’s Law. This law is an observation that the design of any system is significantly affected by the communications structure of the development team. Build vertical teams in which each team can handle the UI, APIs, business logic and data access layers.
Build-and-run team. Have a team that is responsible for a single piece of software from end-to-end and can function independently from other teams.
Decentralized structure. Rather than separate teams into silos with no overlap, take a decentralized approach to reduce delays.
Establish the right team culture. Business and software team leaders should work closely with development teams. Development teams should be empowered and have the freedom to make technological recommendations, such as tooling, to the architect.
How do we migrate to microservices?
With your team ready, plan the migration to microservices. First, find the appropriate service granularity for the application source code and design. The wrong service size, too large or too small, can create complexities and overhead costs. Coach the development team to create services that are as independent and self-sufficient as possible.
Next, ensure developers have a diverse tech stack and a framework that can manage front-end components independently from the back-end infrastructure.
Finally, start the migration by decomposing the monolith. Rely on proven techniques, such as the strangler pattern that gradually replaces old systems with new ones, to minimize user-facing disruption.
According to Twain Taylor, analyst, monitoring is vital to a migration to microservices. Two areas that enterprises need to address are services communication and service failure.
Microservices execute independently but communicate to fulfill a user request. Designers might use an API gateway to manage external communication. For service-to-service communications, add a distributed tracing tool to gain more visibility. Additionally, consider a service mesh to enhance service discovery and monitoring capabilities.
Service failures shouldn’t take down an app. A popular option is the circuit breaker pattern in which a trip mechanism breaks the connection between services in the event of a fault. In this pattern, it retries the connection to test it and restores the connection when the failure is fixed.
5 big pitfalls to avoid during migration
Moving from a monolith to a microservices-based architecture is an admirable task, but development teams can find themselves in a heap of trouble in the process. Taylor warns that teams must absolutely avoid these five migration pitfalls:
1. Moving too quickly. Review the state of existing apps and verify that the organization has the required Agile and DevOps skills.
2. Making services too small. If teams break their legacy applications into services that are too granular, they will end up with more services than they can manage.
3. Coupling services too tightly. Development teams migrating from a monolithic approach to microservices tend to couple the services too tightly, which can create what is known as a distributed monolith.
4. Storing logs in containers. It is an intense process to log microservices, especially when logs are placed inside distributed container instances and frequently terminated. There are better options.
5. Failure to consider monitoring. The migration to microservices introduces a frightening monitoring scenario, as services are often developed on different stacks. Expect tooling investments.