Migration to microservices

Monolith migration to microservices

See my previous post upon reasonable functionality splitting into microservices.
And in this post we’ll consider effective monolith to microservices migration strategies.

Frequently companies / enterprises face necessity to migrate monolith(s) to microservices. Major drivers here are usually the following items:

  • low extensibility;
  • high extensibility cost (due overall change complexity and necessitated testing, overall release duration from requirements gathering till PROD rollout);
  • maintainability cost appears pretty high;
  • frequently limited scaling capabilities.

Hence for to migrate a monolith to microservice architecture, you could consider monolith with loosely coupled services with further gradual extraction of microservices approach. Such an approach proved to be pretty effective strategy in splitting a monolith to microservices. This strategy is usually associated with following steps:

  • increase test coverage to reasonable 85-90% (remember Test pyramid, right?).
    Sure, exclude models and configs from test coverage;
  • prepare to splitting into microservices via consequent grouping and splitting code into appropriate sub-modules and packages;
  • common models extraction and decoupling them into versioned build-time dependencies;
  • infrastructure setup, like build and release jobs, CI pipelines etc;
  • finally microservices extraction

Such gradual extraction of microservices has plenty of advantages, like e.g.:

  • overall less risks, comparing to rewriting a platform using microservice architecture straight away.
    Especially, if documentation is missing or stale, and in real life it’s pretty common, wide-spread situation;
  • gradual migration would allow Development team to better familiarize with subject domain and functionality, better understand domain entities;
  • gradual DevOps effort to prepare build and release jobs due numerous deployable units in new target architecture.

Summary

Monolith migration to Microservices may seem an easy exercise on first glance, but has some pitfalls.
This post highlights few tricky steps, and is aimed to leverage such a migration and associated risks.