Migrating a monolithic application to serverless and microservices architecture

Published: April 13, 2023

By Igor Oliveira, DevOps Engineer at Solvimm (an e-Core company)

As professionals, we always seek to thoroughly understand our customers’ challenges and offer the best possible solution. With Atende Simples it was no different. The company offered an enterprise solution based on a monolithic application model, which did not prove to be efficient in the long run. The application was poorly scalable and flexible, which hindered its growth.

In this post I share with you how Solvimm (an e-Core company), using different AWS services, was able to help Atende Simples with a new architecture.

Atende Simples is a business solution for phone services. The tools offered by the company allow small, medium, and large companies to scale their service with automation, intelligence, and integration with multiple systems. The company started its activities in 2012 and now serves more than 1,500 companies, including Banco Neon, Baterias Moura, Braspag, Trigg, and Lojas Melissa.

Faced with the expedited growth of the solution, they decided to look for alternatives to the monolithic model that was used. Thus, it expected to increase the performance, flexibility, and scalability of the application, as well as to optimize costs. As a partner that could meet these expectations, Solvimm was chosen to architect the new serverless and microservices-based application.

The Challenge

The physical layer of the Atende Simples solution consists of equipment in two different data centers in São Paulo and several redundant connection links with the service providers and the application layer, where the call processing center is located. With the monolithic application model used, resources were not well utilized, since it was necessary to allocate them even if only a small part of the application was used.

Furthermore, as the application code grew, the development stage also took longer to complete, with automated tests for deployment taking almost an hour. Agility is a necessity of the Atende Simples solution, which has specific characteristics, such as complexity and unpredictability of the processing volume.

As the amount of calls fluctuates throughout the day and week, from hundreds per second to few calls (at some times, such as after midnight, few or no calls are made), the elasticity of the application, according to the actual demand of the system, would impact the cost reduction in idle moments. But one of the main challenges encountered by Atende Simples was to adapt the monolithic application to this reality.

The Solution

Migrating a monolithic application to a microservices architecture is complex. Therefore, a strategy was adopted to develop new functionalities and features in the new architecture, and, in parallel, migrate the code refactoring. This started the process of bottlenecking the monolithic application.

Figure 1. Architecture of the proposed solution

The proposed architecture relied on a serverless environment using the AWS Lambda service to execute the functions. Lambda can apply different business rules for each event, in a highly available and scalable manner. Multiple events from different sources trigger functions, which apply business rules and transform the data for consumption by the legacy monolithic application.

The API Gateway and AWS AppSync are used as call proxy for Lambda functions and other AWS resources that need to be accessed by the monolithic application. These resources are DynamoDB, as the database, and SQS and SNS for exchanging and sending messages. DynamoDB allows storing the events generated by the calls quickly when writing, and retrieving them in milliseconds when reading, enabling near real-time reporting.

The application consumes the events by reading an SQS queue, which automatically handles sudden increases in the number of events, and another queue has been prepared for events that might give an error when consumed by the application.

The Results

The use of serverless architecture allowed the delivery of new features with agility. In addition, integration with the monolithic application was done with minimal change to the application.

By using microservices on AWS, only the services actually used are charged. This differs from a traditional infrastructure, where the customer would need to have a number of servers that can handle peak times and keep resources idle during periods when the number of calls is low.

In a month, there are about 10 million Lambda requests to the Atende Simples application, 5 million requests to Amazon SQS, 32 million read requests, and 9.9 million write requests to Amazon DynamoDB. The computing power required to support this load is huge, which is extremely difficult to implement in an on-premises environment.

Figure 2. Total read requests to DynamoDB
Figure 3. Total Lambda requests to the Atende Simples application
Figure 4. Total Amazon SQS requests

Solvimm (an e-Core company) has been in the cloud computing market for six years. It is an Advanced Consulting Partner of the AWS Partner Network and is part of the AWS Public Sector Partner: Education, Non-Profit, AWS Solution Provider and AWS Public Sector Solution Provider programs. In addition, Solvimm is recognized by the AWS Service Delivery Program for delivering solutions with AWS Lambda.

Originally published at the AWS blog on on 17 SEP 2019

e-Core

We are a technology solutions partner for digital innovation and business transformation.
Talk to one of our consultants and learn how we can help you evolve and go further.