Friday, November 17, 2023

Lift And Shift of Monolith Group Of Architecture Patterns

Lift And Shift Of Monolith


 

History

Developer community is busy with Digital Transformation & Application Modernization activities. There are many projects where huge resources are invested to convert Java Monolith Applications into Microservices. The Goal is to realize a cloud native application, which can be scaled individually, manageable by a feasible sized team and is responsive.

We see many articles which talks about "Lift and Shift" of Applications when you move from on-premises to public clouds, but they don't help you when it comes to Monolith Application.

Since 2016, we focused on solving this challenge and find out a way to enable "Lift And Shift of Monolith". We identified the challenges and prepared a strategy around this. Finally, we came up with our first Best Practices which was foundation towards achieving our Automation Goal of Lift And Shift and was published under the heading of Application Modernization in 2019.

We involved into heavy development activities and came up with our first application which demonstrated the Automation using which we can quickly Lift And Shift Monolith class into Microservice. We also hosted an Opensource project with this code so that the developer community can get benefited with this innovation. The user guide and tutorial for the same was nicely described under the Heading Monolith to Hybrid Architecture in 1 Hour. in 2020.

The enhancement of our Tool continued and by 2023, we have deployed the tool on the cloud and is made available as SAAS to our clients, with extensive functionalities.

We identified the Architecture Patterns which can solve the complexities involved in the "Lift And Shift of Monolith", hence it gave birth to "Lift And Shift of Monolith" Group of Architecture Patterns.


Problems addressed

You can transition from Monolith to Hybrid using Strangler Pattern.
 
While Hybrid Architecture allows you to use Monolith Application and it is 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.
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.

 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.

 

How we solve the Problems

We identified best practices and other solutions and came up with a Strategy to minimize the risk and quickly realize Hybrid Architecture.

  1. Take Bottom-To-Top Approach
  2. No Change in Efferent Coupling of the Class
  3. Add Webclient to Dependee Class
  4. Expose Dependee Class over REST
  5. Use Stripped Monolith Application with MVC Wrapper Application
 This strategy is documented in detail at Monolith To Hybrid Strategy
 

Birth of "Lift And Shift of Monolith" Group of Architecture Patterns

 

  1. Wrapper Controller: Responsible to expose Monolith over REST API.
  2. Monolith Class Bridge: Facilitates Communication between Wrapper Controller and the Monolith Class.
  3. Monolith Controller Client: Responsible for maintaining Efferent Coupling of other classes of the Monolith and making REST Call to Wrapper Controller.

Initial Architecture

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.

Target Architecture with applied Patterns



Fig 2: We have Class A, B &C within our Hybrid Application. Vertical slicing of Class B. Wrapper Controller, Monolith Class Bridge & Monolith Controller Client are introduced to the architecture.

 

 

Lift And Shift of Monolith" Group of Architecture Patterns in Action

This pattern is used by Digital Transformation Tools. You can refer to below videos to understand how this pattern helps in Digital Transformation.


1) CodaGeeks Digital Transform Tool:
This Tool helps you to transform your Java Monolith Class into Microservice. This tool is also available as an service ( SAAS ). Refer http://www.codageeks.com for more details.

 
 
 
 
       2)  Miracle Open Transform:
     This is an Open Source project hosted on git hub. It has code which               implements this and other "Lift and Shift Monolith" group of patterns.






What is an Architectural Pattern?

According to Wikipedia,

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design pattern but have a broader scope.

At Miracle Labs, we constantly innovate around real time problems and try to find solutions. While we were attempting early Digital Transformation Projects, we solved complex problems.










Monolith Controller Client

Monolith Controller Client Pattern

Monolith Controller Client Pattern solves complexity involved in exposing a Monolith Java Class into Rest API. By using this pattern, you can easily execute the Monolith Code ( Methods ) as service end points. It ensures that your other classes of Monolith Application are working seamlessly and are able to call the methods of the sliced Monolith Java Class without any modification, after you perform Lift and Shift of the Monolith Class.

This is part of "Lift & Shift of Monolith " Group of Architecture Patterns.

Problems addressed

Below are the problems that you face when you want to slice a single Java Class from a Monolith App.

  1. If you change the syntax ( Name or parameters) of methods of the Java class, it will break the consumer classes and you have to rewrite them as well. The Efferent and Ifferent Coupling will break.

  2. It will become mandatory for you change each and every dependent class, which will be a huge effort.    

 How we solve the Problems

  1. We implement "Monolith Controller Client " Pattern. This class  will have the same method syntax of each public method of the Java Monolith Class. This includes Getter and Setters as well as service methods ( Business Functions )

  2. We replace the body of the Monolith Java Class with this Monolith Controller Client class. This class is capable of calling the "Wrapper Controller" for executing the monolith class methods remotely.
     
  3. The "Monolith Controller Client" is helped by Json Convertors which converts the method data types to Json and vise-versa so that it can send and receive parameters over the REST API Calls.
     
  4.  The "Monolith Controller Client" ensures that all dependent classes are still able to call the monolith class methods without any change.

Monolith Controller Client Architecture Pattern in Action

This pattern is used by Digital Transformation Tools. You can refer to below videos to understand how this pattern helps in Digital Transformation.


1) CodaGeeks Digital Transform Tool:
This Tool helps you to transform your Java Monolith Class into Microservice. This tool is also available as an service ( SAAS ). Refer http://www.codageeks.com for more details.

 
 
 
 
       2)  Miracle Open Transform:
     This is an Open Source project hosted on git hub. It has code which               implements this and other "Lift and Shift Monolith" group of patterns.






What is an Architectural Pattern?

According to Wikipedia,

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design pattern but have a broader scope.

At Miracle Labs, we constantly innovate around real time problems and try to find solutions. While we were attempting early Digital Transformation Projects, we solved complex problems.










Monolith Class Bridge Pattern

Monolith Class Bridge Pattern

Monolith Class Bridge Pattern solves complexity involved in exposing a Monolith Java Class into Rest API. By using this pattern, you can easily execute the Monolith Code ( Methods ) as service end points. It ensures that "Wrapper Controller" is seamlessly able to call the methods of the sliced Monolith Java Class. This enables the request response of the remote calls. You can then realize all benefits of the cloud application for your same monolith code.

This is part of "Lift & Shift of Monolith " Group of Architecture Patterns.

Problems addressed

Below are the problems that you face when you want to expose a single Java Class from a Monolith App as Rest API.

  1. If you change the syntax ( Name or parameters) of methods of the Java class, it will break the consumer classes and you have to rewrite them as well.

  2. The formal data types of the parameters of the methods are not directly supported for Request / Response, as required by REST API best practicies.
       

 How we solve the Problems

  1. We implement "Wrapper Controller " Pattern. The REST Controller will have an unique end point, corresponding to each public method of the Java Monolith Class. This includes Getter and Setters as well as service methods ( Business Functions )

  2. We add "Monolith Class Bridge" Java class to the application. This class acts as a bridge for the conversion of datatype of request payload and response body to the datatypes matching to the method parameters and there return types.
     
  3. Monolith Class Bridge is linked to the "Wrapper Controller", hence all the upstream requests received by the "Wrapper Controller" are forwarded to Monolith Class Bridge, which delagtes the call to the actual Monolith Class and captures the result of the method being called.
     
  4. Monolith Class Bridge is then responsible of converting the result of the method call into the required Json string such that controller can send it back as the Response.

Monolith Class Bridge Architecture Pattern in Action

This pattern is used by Digital Transformation Tools. You can refer to below videos to understand how this pattern helps in Digital Transformation.


1) CodaGeeks Digital Transform Tool:
This Tool helps you to transform your Java Monolith Class into Microservice. This tool is also available as an service ( SAAS ). Refer http://www.codageeks.com for more details.

 
 
 
 
       2)  Miracle Open Transform:
     This is an Open Source project hosted on git hub. It has code which               implements this and other "Lift and Shift Monolith" group of patterns.






What is an Architectural Pattern?

According to Wikipedia,

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design pattern but have a broader scope.

At Miracle Labs, we constantly innovate around real time problems and try to find solutions. While we were attempting early Digital Transformation Projects, we solved complex problems.










Wrapper Controller Architecture Pattern

Wrapper Controller Architecture Pattern

Wrapper Controller Architecture Pattern solves complexity involved in exposing a Monolith Java Class into Rest API. By using this pattern, you can easily execute the Monolith Code ( Methods ) as service end points. Thus you can add this Rest API as Microservice within your cloud applications. You can then realize all benefits of the cloud application for your same monolith code.

This is part of "Lift & Shift of Monolith " Group of Architecture Patterns.

Problems addressed

Below are the problems that you face when you want to expose a single Java Class from a Monolith App as Rest API.

  1. You cannot scale out a single Java class from Monolith Application

  2. If you change the syntax ( Name or parameters) of methods of the Java class, it will break the consumer classes and you have to rewrite them as well.

  3. The formal data types of the parameters of the methods are not directly supported for Request / Response over Rest API
       
  4. We cannot slice a Java class from Monolith as it is A Single JVM Application

 How we solve the Problems

  1. We create a serverless application ( Spring Boot / Thorntail ) and add a REST Controller to the application and the Monolith Jar.

  2. The REST Controller will have an unique end point, corresponding to each public method of the Java Monolith Class. This includes Getter and Setters as well as service methods ( Business Functions )

  3. Call to REST Endpoints will further propagate to the Java Monolith Class. We wire the Java Monolith Class ( as service ) to this Controller Class

Wrapper Controller Architecture Pattern in Action

This pattern is used by Digital Transformation Tools. You can refer to below videos to understand how this pattern helps in Digital Transformation.


1) CodaGeeks Digital Transform Tool:
This Tool helps you to transform your Java Monolith Class into Microservice. This tool is also available as an service ( SAAS ). Refer http://www.codageeks.com for more details.

 
 
 
 
       2)  Miracle Open Transform:
     This is an Open Source project hosted on git hub. It has code which               implements this and other "Lift and Shift Monolith" group of patterns.






What is an Architectural Pattern?

According to Wikipedia,

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. Architectural patterns are similar to software design pattern but have a broader scope.

At Miracle Labs, we constantly innovate around real time problems and try to find solutions. While we were attempting early Digital Transformation Projects, we solved complex problems.










Tuesday, September 5, 2023

Convert An(y) Monolith Opensource git Project Into Hybrid Application using Digital Transform tool in less than 20 mins.

Automate Monolith to Hybrid Application

Quicker Digital Transformation

We are in the world of cloud, and applications have to be smart enough to support cloud computations. We often see Monolith applications around us.  Architects are tempted to rewrite the Monolith App into Microservices but we can now reuse the existing functionality of Monolith, which is tested, supports Testing. We can now scale that code without giving huge Time - Material - Efforts on conversion.

Using Digital Transform Tool

Miracle has formed A new Team specialized for Digital Transformation with identity "CodAGeeks". They have recently launched cloud based Tool for Digital Transformation. It is quick and works as Charm!

I will demonstrate the use of the tool and briefly explain its features here.
 
The Tool can be accessed at  http://codageeks.com/demo.html

You can request A token to execute the transformation by sending an email on support@codageeks.com
 

Selecting the Project to Transform

I visited http://www.github.com to select a widely used Monolith Application in Java, since the tool only supports Java code base as of now. I selected the project with below details.

  • url: https://github.com/hta218/StoreManager/
  • Monolith Functional Class to Transform:  src/Functions/pdf_Export.java
  • Libs folder: /lib
  • Libs used:  itextpdf-5.3.4.jar:jcalendar-1.4.jar:sqljdbc4-3.0.jar:jtds-1.3.1.jar
  • Binary Folder: /build/classes

Purpose: This class has most Efferent coupling with other classes in the project. It is been called to  converting the invoice to pdf. For an enterprise, this can be a use case to scale this class to support multiple requests across various departments.

End Result of the Transformation

  1. Rest Controller: You will see that pdf_Export.java is exposed through a controller class and the entire code is wrapped into a Thorntail Microservice Application. Hence You can now Horizontally  scale this code.

  2. Modified Monolith Code: Existing Monolith code is modified in such a way that You don't have to do any further customization. The new Monolith code will consume the new Rest end point without any manual intervention.

Executing the Digital Transformation Tool:

 I opened the tool url http://codageeks.com/demo.html in chrome browser. 







    I have received 3 tokens after mailing to support@codageeks.com

I gave below details in the input boxes:


 


    

 

    I am sharing the inputs below in Plain Text:

Git Project URL:"https://github.com/hta218/StoreManager/",
Git Project Branch:"master",
Project Folder Name:"StoreManager",
Project Source Path From Git Root: "src",
Project Binary Path From Git Root: "build/classes",
Filename of the class to Transform:"Functions",
Path of the class to Transform From Source Folder:"pdf_Export.java",   
Library Folder Path From Git Root:"/lib",
Libs in ':' separated list :"itextpdf-5.3.4.jar:jcalendar-1.4.jar:sqljdbc4-3.0.jar:jtds-1.3.1.jar:"


You can use your Digital Transformation Token and git credentials.

On successful Transformation, you will see a response with link to the new code for you to download:

 

 

Incase the tool is not able to Automate the transformation you can subscribe to the support plans.

Checking the modified Code

The downloaded zip file is having below folders:

1) Microservice : This is the Thorntail Application project folder. The REST Controller for the pdf_Export class is located at inside it, as shown below:



 

 

 2) Monolith/StoreManager : The existing pdf_Export.java class is modified to consume the Microservices. All the test cases are still valid as the class efferent coupling remains intact.






Executing the transformed code

You have to execute Microservice and the newMonolith application. There is no change in the way you execute the newMonolith as compared to StoreManager( Monolith)

Copy the Microservice and newMonolith Folders into same file system from where you executed Monolith application, earlier to the Digital Transformation.

  • Executing Microservice: Navigate to the Microservice/ThorntailDemo folder in conole applilcation, and issue the commnd mvn thorntail:run.

You have to manually copy your dependencies of Monolith Application to the Thorntail Demo. You will observe that Microservice Application is listening on port 8080 on your local machine.

  • Executing newMonolilth: Just execute it in the same way you did execute Monolith application. You will notice that your newMonolith Application is trying to connect to your local port 8080.

 

Additional Notes:

CodAGeeks provides support services to transform complex Monolith application in just 15 days !!!

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 .





Friday, May 1, 2020

Transformation Experts

Application Modernization

 

Transformation Experts is a team of IT Professionals who have master the space of Application Modernization. Your best bet is the  expertise and experience of the team who will drive the Application Development for you. Here I will mention about important aspects of Technical Qualification, Skills and Roles of the Developers & Architects.

This blog is for Software Professionals & Enterprise IT Managers who are aware of Application Modernization concepts.

Technical Skills & Roles

Application Developer Team should have varied Technical Expertise
  1. Certified Professionals
  2. Cloud Architects
  3. Microservice Developers
  4. Application Developers
  5. Architects
  6. Multi-Cloud Experts

 

Certified Professionals

Certification is assessment of demonstration of skills. Prominent Certifications are available for IT Professional in the field of Distributed Application Development & Management. Having certified professionals in your team will increase your chances of lowering the mistakes and adhering to your planned delivery timelines. Prominent certifications are as follows:
  • Microservice Developer Certification from RedHat.
  • Solution Architect & Developer Certification from AWS.
  • Developer Associate Certification from Azure.

Cloud Architects

Cloud Architects help your services to be compatible and make best use of Cloud Native features. Cloud native applications are best suite for your Modern Applications. While each Cloud vendor has specific features unique to their offerings, A generalized expertise is organized by adhering to the use of industry practices like using Kubernetes.
    Cloud Architects contribute to unique features for the desired cloud platform, hence your applications can take advantage of available options. Eg. Lambda services in AWS is similar to Azure functions. Complexity in working with similar and distinctive features of Cloud is solved by Cloud Architects.

    Microservice Developers

    Microservices can be of various types and they can adopt to various Inter Service communication channels. There are many technology stacks which are best for few types of requirements while they are good for almost any microservice.
    • Microprofile & Spring are used for Java based Microservice Developement.
    • Node.js, React Js, Vue.Js are for Javascript based Microservice Development.

    Microservice Developers use their expertise for Microservice Development.

    Application Developers

    Application Developers have skills for developing in Java, .Net, Node.js etc languages.  Their contribution is important to meet the business functionality within the Modernized Application. The business functions are implemented by these developers and they become part of Microservices.

    Architects

    Architects are involved from initial state of Application Modernization where they come up with Compliance requirements like Enterprise Architecture, Devops, Delivery Guidelines etc. They decide on the execution platforms, communication channels, scaling, resiliency etc features of the application

    Multi-Cloud Experts

    In the time of Infrastructure As A Service, where Enterprises have to select best option from Public to Private Clouds and combination of On-Premises and On-Cloud Infrastructure, Multi-Cloud Expertize should always be handy for smooth execution of Modernized Applications.

    Knowledge of Orchestration tools like Kubernetes & Openshift along with unique offerings of each vendor will influence the Architecture decision for your Modernize application.

      While this are just high level activities, things can go very dizzy as you move ahead. "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 on their website's Contact Us section.

      New Patterns Introduced for Digital Transformation

      Wrapper Controller: It adds Rest Controller which wraps the Java Class. All methods are exposed through matching endpoints.
       
      Class Bridge: It bridges the conversion of datatype of request payload and response body to the datatypes matching to the method parameters and return type
       
      Controller Client: It replaces the method body with the call to rest client. It uses Json convertors to transform the Datatypes into Json which can be sent as payload to the rest client and also to convert the response into the Java class types of the response.