Saturday, May 2, 2020

Monolith to Hybrid Architecture in 1 Hour.

Application Modernization



Transformation from Monolith to Hybrid Architecture is challenging and may take days and weeks for realizing first Microservice within A Hybrid Architecture.

In this Blog, I am going to discuss an option which can quickly and safely land you on a Hybrid Architecture from Java Monolith within no time! The name of the Tool is Open Transform available on https://github.com/miracleatwork/opentransform.

This tool automates transformation of Monolith to Hybrid Application.


I have been part of several Application Modernization exercises and I have faced several technical challenges. While Hybrid Architecture allows you to use Monolith Application and one of the component within Modernization, arriving to that state has its own challenges, which can be listed as follows:
  1. Manual modification of Monolith App code is time consuming.
  2. Executing modified code of Monolith App involves more than trivial efforts.
  3. Realization of benefits of Hybrid Architecture is realized only after substantial effort and time is invested over the transition of the Monolith Application. 
  4. Inter-Service communication and Monolith communication channels can add complexity to the Architecture.
  5. We need to save our Architecture from implementing Anti-patterns.

Unique Approach to Transformation

We want to break a Monolith Application into A Hybrid Architecture. This approach can be as complex as the Application itself, while very simple at Microlevel.

Monolith Application is primarily complex with respect to Architecture for:

  1. Monolith Application has huge code base.
  2. Individual Classes( DAO, VO, Service, etc) are tightly coupled
  3. The VM for their execution is generally shared.
  4. Analysis & Mapping of dependencies takes huge efforts.
  5. Vertical Slicing becomes very complex and iterative due to coupling.

Strategy to minimize the risk and quickly realize Hybrid Architecture

  1. Take Bottom-To-Top Approach

    Here we focus on individual classes which are candidate of Microservice Functions. This classes will obviously have public & protected methods and there will be other classes, which are dependent on it. If we change the structure of this class, the application will start breaking due to this coupling.

    Fig 1: We have Class A, B &C within our Monolith Application. For Vertical slicing, if we process Class B, keeping its structure intact, Monolith Application can still function with modified class.
  2. No Change in Efferent Coupling of the Class

    Efferent Coupling is termed as The number of classes in other packages that the classes in the package depend upon is an indicator of the package's dependence on externalities. If we don't change this Coupling for the Dependent Classes, our complexity of slicing is highly reduced. This also saves lot of time & efforts!


     Fig 2: We Modify Class B to enable it as a service, keeping its structure intact, Monolith Application can still function with modified class.

  3. Add Webclient to Dependee Class

    We will replace the internal functionality of the Dependee Class B with a webclient which can perform a HTTP request for the state of the Class B.
    The local JVM method call within Class B is now replaced with a HTTP request call but Dependent Class A is Agnostic of this change.

     Fig 3: We Modify internal method definition of Class B and add WebClient to it.



  4. Expose Dependee Class over REST

    Once we modify Dependee Class to expose its state over REST endpoint, it can service the Monolith Dependee classes over the REST Endpoints through HTTP Request. This way we readily get Hybrid Architecture.



     Fig 4: We add Controller Wrapper for Class B and make it accessible over REST endpoint.


  5. Use Stripped Monolith Application with MVC Wrapper Application

    After we modify the Dependee Class, our Monolith Application will still function in the same way as it did earlier because we have not changed the structure of Dependee Classes. Hence we don't put any extra efforts due to stripping of the Dependee Class in Monolith Application.

    We wrap Dependee Class in a MVC Application and make it available as REST Service, hence it qualifies for Microservice Application.


    Fig 5: We transform Monolith Application to Hybrid Architecture

    You can also check Package Diagram, Component Diagram and Deployment Diagram of this hybrid application from its Presentation available at https://github.com/miracleatwork/opentransform/blob/master/docs/OpenTransform.pdf
    Open Transform automates this entire process for you and hence you can start your Application Modernization instantly using Open Transform. How to execute Guide is also available on https://github.com/miracleatwork/opentransform/blob/master/docs/HowToExecute.pdf

    About Open Transform

    Open Transform allows you to quickly transform your Monolith into Microservices. Its an automation of various manual activities that developer does in order to transform Monolith Application.

    Open Transform adheres to many best practices like Java Conventions, Test Driven Development, Open Software Stack like Microprofile, Thorntail etc.

    "Transform" tool from Miracle Software Solution can help you in automating many of these activities and get a Microservice Hybrid Application instantly, in less than 5 Hours. You can also evaluate it within free workshop. You can request the same through an email on support@codageeks.com .





No comments:

Post a Comment