Microsoft Workloads on AWS

How AWS Microservice Extractor for .NET helps Kloia accelerate the modernization journey of their customers

By Prasad Rao – Sr. Partner Solutions Architect at AWS
    Ekin Barut – Software Consultant at Kloia

Legacy monolithic .NET Framework applications are common in many organizations. Splitting a monolith application into smaller fine-grained microservices is an important part of the modernization journey for these organizations.

Modernizing monolith application by converting to microservices helps these organizations to achieve the agility and release new features faster. It also helps organizations scale their applications better as individual components of the service can be scaled independently.

Today, AWS announced a new tool, AWS Microservice Extractor for .NET, to accelerate the process of splitting the monolith into microservices. The tool helps in identifying, visualizing, and extracting components of monoliths into microservices with an intuitive interface.

In this post, we’ll describe how Kloia plans to leverage Microservice Extractor for .NET to accelerate .NET application modernization journey of their customers. We also provide a tutorial of the tool to showcase its features.

How Kloia modernizes their customers .NET legacy applications

Kloia, an AWS Partner Network (APN) Advanced Consulting Partner with AWS Competencies in DevOps and Microsoft Workloads, help organizations with their digital transformation by modernizing their legacy application to AWS cloud-native applications.

For example, Kloia modernized monolithic .NET applications for organizations like GoDataFeed, EposNow, and Otelz. Key component for modernizing these applications is refactoring the monoliths into microservices.

However, decomposing a monolith application presents many challenges as it requires understanding of the existing code base and having context of the business domains. The refactoring patterns like Strangler Fig and Branch by Abstraction are useful to incrementally transform monolithic application into microservices and other distributed designs. However, most of the process of refactoring the code base is manual, error prone, and time consuming and can become a hindrance that slows down the pace of an organization’s modernization journey.

Kloia has developed niche expertise in breaking down monolithic architectures and decoupling existing, tightly coupled services into microservices. Kloia uses Domain Driven Design and Event Storming to get clarity of domain models and business contexts of the application. It helps them to provide complexity-value analysis for each domain that they use as prioritization technique. The complexity-value graph provides a guideline for the roadmap planning. For its customers Kloia’s typically suggests a modernization path that starts with Low-Complexity and High-Value functions.

The new tool, AWS Microservice Extractor for .NET, helps Kloia to visualize the components of applications at code level, group them together into different domains and bounded contexts, and extract them into independent services iteratively. This accelerates the pace at which the applications can be modernized.

In the following section, let us dive deeper into how AWS Microservice Extractor for .NET simplifies splitting the .NET monolith application to microservices.

Legacy application modernization using AWS Microservice Extractor for .NET

To showcase legacy application modernization using AWS Microservice Extractor for .NET, we will use MvcMusicStore from AWS GitHub samples. MvcMusicStore is a legacy .NET framework MVC e-commerce application.

Prerequisites

For this tutorial, you should have:

Step 1: Onboard an Application

The first step is to onboard an application in the tool using the following steps:

  • Launch the AWS Microservice Extractor for .NET and choose Get started.
  • Choose Onboard application, provide application details, and select MvcMusicStore.sln from your local drive as shown in Figure 1.

Figure 1: Onboard an application in AWS Microservice Extractor for .NET.

Figure 1: Onboard an application in AWS Microservice Extractor for .NET.

Optionally you can provide runtime profiling data that is used by the tool to provide call count data with dependency details in the graphical representation of the application. There is also an optional step to analyze .NET Core portability if you have Porting Assistant for .NET installed.

After providing these details, choose Onboard Application to start the onboarding process of the application. The onboarding process may take few minutes depending on the size of your project. You will be redirected to the Applications screen where you can monitor the progress of the project.

Once the onboarding is complete the status is marked Success as shown in Figure 2.

Figure 2: Application onboarding complete with status as Ready for visualization.

Figure 2: Application onboarding complete with status as Ready for visualization.

Step 2: Visualize application

The next step is to dive deep into the application analysis. Select an application and choose Launch visualization to navigate to application details page.  The analysis is divided into two sections or tabs – Applications Details and Visualization.

Application details tab summarizes the application-related information. It also displays the MSBuild logs and status of the extracted services as shown in Figure 3.

Figure 3: Application details tab of AWS Microservice Extractor for .NET.

Figure 3: Application details tab of AWS Microservice Extractor for .NET.

Choose the Visualization tab to view the graphical representation of the monolithic application nodes and the dependencies between them as shown in Figure 4. Nodes represent the class objects in the source code of the application.

Figure 4: Visualization tab of AWS Microservice Extractor for .NET

Figure 4: Visualization tab of AWS Microservice Extractor for .NET

The visualization provides a high-level view and helps you investigate dependencies and call count metrics to make decisions about parts of the application to extract into smaller, independent services.

You can scroll to zoom in and out and choose the nodes to display node details. Context menu of the node provides following options:

  • View node details
  • Add node to group
  • Remove node from group

Step 3: Create groups

Open the context menu of the selected node and select Add node to group to start grouping your services based on their dependencies. In this tutorial, you will group MvcMusicStore.Controllers.AccountController as an Account group as shown in Figure 5. This component has the least dependencies on the rest of the services.

Figure 5: Create a group in Visualization tab.

Figure 5: Create a group in Visualization tab.

Analysis and Grouping are the most helpful features of the tool in .NET modernization projects for Kloia. They not only provide a high-level snapshot of the current status of the application but also help to create a drafted roadmap on how to break down the application.

The Group color feature can be used to indicate the complexity-value for each group. For example, you can assign green to Low-Complexity and High-Value groups, red to High-Complexity and Low-Value groups, blue to High-Complexity and High-Value groups and so on. This further helps in visualizing the complexity-value of each component and roadmap planning.

Kloia provides a consulting service of deep assessment to go through the client’s existing application code and infrastructure to create a complexity-value graph and possible roadmap on how to proceed with splitting the monolith. The visualization, along with grouping of nodes, significantly reduces the manual effort required to do this deep level analysis and understand how services are coupled, detect islands, and isolate dependencies.

Step 4: Extract service

Select the Account group and choose Extract as a service. On the Review details and initiate extraction page, you can review the details of the groups you selected and their individual nodes and dependencies as shown in Figure 6.

Figure 6: Review details and initiate extraction page.

Figure 6: Review details and initiate extraction page.

When extracting a selected group as a service, there are likely to be method invocations going from the monolith to the group being extracted. You can choose between the two options – remote method invocations or local method invocations. The remote method invocations option exposes these invocations as network endpoints on the extracted service and modifies the original application code copy to call those remote endpoints. Whereas, the local method invocations option provides a guidance on where to manually begin refactoring the code by leaving auto-generated comments in the source code.

Choose Extract to start the extraction process. The extraction takes a few minutes to prepare the new service as an endpoint.

Step 5: Review modified application code

When the extraction is completed, a directory with a unique name will be created at the location configured during the initial setup.

The code changes done by the tool depends on the component being extracted. If you are extracting any component of the application other than a controller, the tool creates an endpoint adapter implementing factory pattern to abstract remote calls. The previous local calls to the service are updated to the new service using an auto-generated interface to provide the abstraction between the monolithic application and the microservice.

However, in our scenario the controller is being extracted. The tool extracts the controller along with all its dependencies. The extracted service is still an MVC project and the code in the extracted controller remains the same. The project level structure of the extracted service is shown in Figure 7.

Figure 7: Project level structure of the extracted service

Figure 7: Project level structure of the extracted service

The existing application code is also updated to ensure the original controller forwards the requests as is to the extracted service controller.

If the tool is not able to create the remote invocations to the extracted services then TODO comments are added to the code files.

Step 6: Configuring endpoints for remote invocations

The extracted service can be deployed independently, and the endpoint connection string of the deployed independent microservice can be provided in the web.config shown in Figure 8.

Figure 8: Web config to provide EndpointConnectionString of the extracted service.

Figure 8: Web config to provide EndpointConnectionString of the extracted service.

However, when you are extracting the controller you also need to provide the ServiceHost and ServicePort of the deployed extracted service controller in the appsettings of the web config.

Conclusion

In this post, we provided walk-through of how AWS Microservice Extractor for .NET accelerates the modernization of .NET monolithic applications. AWS Microservice Extractor for .NET analyzes your monolithic applications and, based on the analysis, produces a graphical representation that displays the application nodes and dependencies between them. The interactive graph allows you to group nodes by functionality to help you make decisions about which parts of the application to extract as independent services.

To get started, download AWS Microservice Extract for .NET for free and refer to User Guide.

Modernizing your legacy .NET applications can be transformative. Choosing trusted providers with niche expertise in this space is critical to achieving the desired value-add and results. If your organization has legacy applications, engage with Kloia to learn how they can accelerate your modernization journey.


AWS can help you assess how your company can get the most out of cloud. Join the millions of AWS customers that trust us to migrate and modernize their most important applications in the cloud. To learn more on modernizing Windows Server or SQL Server, visit Windows on AWS. Contact us to start your migration journey today.

Prasad Rao

Prasad Rao

Prasad Rao is a Principal Partner Solutions Architect at AWS based out of UK. His focus areas are .NET Application Modernization and Windows Workloads on AWS. He leverages his experience to help AWS Partners across EMEA for their long term technical enablement to build scalable architecture on AWS. He also mentors diverse people who are new to cloud and would like to get started on AWS.