DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Software Design and Architecture
  3. Microservices
  4. From Monolith to Microservices: How to Make the Transition

From Monolith to Microservices: How to Make the Transition

Switching to microservices affects more than your software architecture. It gets at the very culture of how you develop.

Jason Smith user avatar by
Jason Smith
·
May. 17, 19 · Opinion
Like (4)
Save
Tweet
Share
9.51K Views

Join the DZone community and get the full member experience.

Join For Free

Migrating from a monolithic system to a microservice architecture is a journey to behold, but we all know the reasons why you want to make this move. Microservices offer flexible scalability, rapid deployment, and adaptability, things monolithic systems tend to lose as they grow well beyond its operational capability.

But transitioning towards a microservice architecture requires thoughtful planning as well as careful consideration of a number of factors, that we have highlighted below in this article.

First, Formulate a Transition Plan

Breaking down massive legacy applications into microservices is risky business, and, if not done correctly, you could suffer from a dented reputation that could be difficult to salvage.

Having a plan and a roadmap in place, which centers around your business’s needs, is imperative and needs to be done first.

If you are committed to transitioning to a microservice architecture, stop building on top of your monolith, and instead turn to develop microservices for the introduction of any new features and functionalities. This will enable you to start decommissioning any old and unwanted features as you work on your new projects, and it will help you clear up any technical debt.

As you plan your microservice architecture, just keep in mind that microservices have their own independent ecosystem where they have their own databases and UI. Therefore, factor in how you are going to allocate your resources for each microservice.

Break Down Your Monolith Slowly and Incrementally

On your journey towards transitioning to a microservice architecture, and this can be done during the initial planning stage, first, take stock of your monolith architecture. Identify all the key components within your architecture and their inter-system relationship with each other.

Ideally, you should target any components that are loosely coupled to the legacy system or require frequent updates first. And there is a good reason for this.

According to Neal Ford, author of Building Evolutionary Architectures, extracting components from a monolith involves careful extraction of the component’s data, logic, and UI, and then redirecting them to a new service. For developers, this is a heck of a lot of work and the components that you want to turn into microservices would need to justify the benefits of a microservice architecture.

Targeting these components would minimize the workload for your engineers. Also, the components that do require frequent updates actually benefits from becoming a microservice, since you’ll only be deploying to that isolated service rather than the entire system.

Additionally, as Vivek Juneja wrote in The New Stack, transitioning to microservices involves slowly replacing the functionalities discretely while “minimizing the changes.” The last thing you want is for your entire system to break down because you went gung-ho with your transition.

Determine the Appropriate Size for Each Microservice

A widely debated topic that often arises during the transition to microservices is determining the size of each individual service. After all, the main objective to microservices is to “not make a monolith out of it” as Juneja stated.

The Single Responsibility Principle, where each microservice performs a single unilateral function, is the main driving force when it comes to determining the size of microservices. However, one should keep in mind whether it is absolutely necessary to have a microservice for a particular function at all. If a function works well in the monolithic architecture, then why break it.

Utilize an API Gateway

As microservices operate independently, to provide the same functionality as your monolithic system they would need to communicate and integrate with each other. A common practice that is used when a part of a system is being redesigned via microservices is utilizing glue code.

However, a better alternative to enable microservices to communicate with each other is through using an API gateway. With an API gateway, you can combine and integrate individual microservices together via API calls. In using this option, you significantly reduce the cost of integration and easily add and remove components when necessary.

You can also develop an API for your monolithic system to enable different microservices to connect your monolith.

Embrace a DevOps Culture

In a microservice architecture, it is common practice to assign an individual team (or a single engineer) to one microservice. But it is not good practice to have two siloed subset teams handling a single microservice.

This is where DevOps comes in. With DevOps, each individual member of the team assigned to a microservice has cross-functional responsibilities, meaning they are fully accountable for the entire lifecycle of the microservice, from development, deployment, testing to release.

DevOps fosters a collaborative working environment, and this shouldn’t be isolated to an individual microservice. The more you break up your monolith, the more emphasis there should be placed on ensuring each microservice team is openly communicating and collaborating with each other.

Besides DevOps, it is also important to lay down some governance. One of the perks of a microservice architecture is that teams can develop their assigned microservice using the database, programming language and framework of their choice. However, the drawback here is that a lack of standardization will lead to multiple versions and libraries. Therefore, make sure you set some rules and regulations which specifies what tools and solutions your development teams can use.

Leverage Containers (First for Testing, Then for Everything Else)

A major teething issue that occurs when progressively transitioning to a microservice architecture is testing. During the course of the transition, and when developing microservices, teams will need to regularly perform integration testing with the monolithic system. This is to ensure any operations that span the pre-existing monolithic system and the new microservices do not fail.

You want to avoid running tests on a live monolithic system in case anything were to go wrong, you’re better off running tests against a mock-up of your monolith. One way to achieve this is to containerize your entire system using Docker containers and Kubernetes, for container orchestration. In doing so, you will be able to deploy a test infrastructure and provide your team with the ability to perform integration tests locally, without affecting the entire system.

Breaking Down a Monolith Into Microservices? Slow and Steady Wins the Race

Transitioning to a microservice architecture doesn’t happen overnight. There are many factors to consider such as knowing what components you need to isolate, the time it takes to isolate the component, testing, having a gateway that enables microservices to communicate with each other, as well as adopting a whole new cultural philosophy and mindset.

The overall transition should be seen as a gradual process, this would help to mitigate any unwanted surprises.

microservice Architecture Kubernetes teams

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Seamless Integration of Azure Functions With SQL Server: A Developer's Perspective
  • How To Select Multiple Checkboxes in Selenium WebDriver Using Java
  • Event Driven 2.0
  • Integrate AWS Secrets Manager in Spring Boot Application

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: