Monoliths to Microservices: Untangling Your Spaghetti

Use AI and automation to refactor monolithic applications into microservices.


I had the opportunity to meet with Bob Quillin, Chief Ecosystem Officer at vFunction. Bob presented in the Source Lounge in the Developer Hub at JavaOne.

The premise of Bob's presentation is to use AI and automation to refactor monolithic apps into microservices faster, easier, and with less risk.


The Pain

Engineering velocity has slowed. Monolithic applications are hindering innovation due to compounding technical debt. The points of pain include:

  • Long test cycles

  • Long release cycles

  • Inability to meet business requirements

  • Difficult to ramp up developers

  • Poor customer and user experience

Technical debt has a people effect as well. Developers don't want to work on legacy code, they want to work on greenfield projects. Another pain is that engineering velocity has slowed. Monolithic applications do not scale and have zero elasticity. This results in out-of-control costs, downtime, and poor user experience.

Microservices are more cost-efficient than monolithic applications. Microservices take advantage of cloud on-demand services like serverless. They also scale. The goal is to break monolithic applications into pieces. Modularize the components into containers. Doing this enables you to see how the code interoperates with each other. Seeing how things connect is a key architecture issue.


Migration to Modernization Strategy

The four stages of a migration to a modernization strategy are:

  • Re-host,

  • Re-platform,

  • Refactor/Rearchitect/Rewrite,

  • Continuous Modernization.

Re-host and re-platform involve containerization. Containerization improves security and simplifies DevOps. Yet, there is no:

  • Code modernization,

  • Technical debt removal,

  • Architectural changes,

  • Scalability/elasticity,

  • Accelerated engineering velocity.

While there are significant benefits to microservices:

  • Accelerated engineering velocity

  • Shorter test and release cycles

  • Increased scalability and elasticity

  • Increased innovation

  • An accelerated rate of change aging all applications faster

  • Today's apps will be legacy tomorrow

Use Cases

The three most common 2022 app modernization use cases are:


Broad legacy application estate:

  • A large number of applications to assess

  • Unsure what to retire, rewrite, refactor, etc.

  • Need to rank and develop data-driven business cases

Several megalithic apps with 10M+ lines of code:

  • Several key apps identified

  • Business-critical. selective and iterative refactoring required

  • Architects have identified specific services but need tools and acceleration

Monoliths in the cloud:

  • Monolith is already in the cloud either lifted and shifted or gen 1 cloud apps

  • Costs are rising, agility is falling, and the business is affected

  • Need to realize cloud benefits of agility, release cycles, innovation, velocity, and scalability

Unfortunately, 78% of app modernizations fail. These are manual, not automated.


Two Types of Monoliths

High exclusivity, simple topology, and lower effort:

  • Typical size: Up to 2,000 classes

  • Arrive at the desired microservices architecture in 1 to 2 iterations

  • 90% of monolithic decomposition is automatic

  • Quickly distribute tasks to dev teams

  • Start modernizing services

Low exclusivity, complex topology, higher effort

  • Typical size: 10,000 classes and higher

  • Initial target architecture may differ from the originally desired microservices architecture

  • Refactor sources of complexity

  • Create a common library for monolithic services (90% automatic)

  • Redeploy monolith

  • Reevaluate target architecture

Assessment and Modernization

The assessment hub is a static analysis. It accesses, prioritizes, and builds the business case for application modernization projects by looking at:

  • Technical debt: the level of debt in an app affects the rate and cost of innovation. It is a key business measure for modernization decisions.

  • Risk: analyze how a change in one part of the application will affect another part of the application.

  • Complexity: understand the degree to which class dependencies are entangled. This reduces the level of modularity of the code.

The modernization hub analyzes, designs, and refactors monolithic applications. It uses machine learning to calculate architectural technical debt. Clusters static dependencies into communities. Extracts features by:

  • Graph complexity of highly connected communities (e.g. infrastructure)

  • Graph complexity of other communities (e.g. service)

  • Connectivity between communities

  • Level of connectivity between service communities

  • The average number of dependents and length of dependency chains

Strangler Fig Pattern

Martin Fowler introduced the strangler fig pattern as a way to manage risk when modernizing or rewriting large, monolithic systems. The pattern is an analogy for a type of plant that begins life as a vine growing alongside an older, established tree,

By using an assessment hub and modernization hub to analyze and extract services, engineers can use networking and load balancing as the "strangler façade." Begin with a monolith. Strangle one service. Strangle many services. End up with a microservices-based architecture. Application owners, architects, and product managers can sign-up for the assessment hub and test three applications at no cost.