Download the Capri Loans App today. Download now!

Achieving Real-Time Scalability: Capri Loans Auto-Scaling Success with AWS MSK and ECS

7 Sept, 2024
Achieving Real-Time Scalability: Capri Loans Auto-Scaling Success with AWS MSK and ECS

Introduction

At Capri Loans, we are committed to delivering seamless and reliable financial services by leveraging cutting-edge technology. As a fintech company, real-time data processing is essential for loan approvals, transaction processing, and credit assessments. To handle these workloads, we rely on Apache Kafka, deployed using Amazon Managed Streaming for Apache Kafka (MSK), along with AWS ECS (Elastic Container Service) to run our microservices.

Recently, we implemented a highly efficient auto-scaling solution that dynamically adjusts ECS tasks based on Kafka message lag, utilizing AWS MSK for Kafka message streaming. This achievement has optimized our infrastructure and significantly improved customer experience, operational efficiency, and cost management.

This blog showcases our successful deployment of this advanced solution and its impact on Capri Loans' operations.


The Challenge: Managing Real-Time Financial Data with AWS MSK

As our customer base and transaction volumes grew, so did the volume of real-time data streaming into our system. Our services use AWS MSK to manage Kafka clusters for handling this high-throughput message data. However, data traffic spikes during key events—such as end-of-month loan repayments and promotional campaigns—caused our Kafka consumers to struggle to keep pace with incoming messages, leading to increased Kafka SumOffsetLag.

Key Challenges:

  1. Delayed Transactions: When Kafka consumers couldn’t process messages quickly enough, the backlog (SumOffsetLag) increased, delaying critical processes like loan approvals and credit assessments.

  2. Inefficient Resource Management: Without dynamic scaling based on Kafka message lag, our ECS tasks were either under-provisioned during traffic spikes or over-provisioned during low traffic, leading to inefficient resource usage.

  3. Manual Scaling: Adjusting ECS task counts manually was time-consuming, inefficient, and error-prone, resulting in delayed processing and higher costs.


The Solution: Auto-Scaling AWS ECS Tasks Using Kafka Lag from AWS MSK

To address these challenges, Capri Loans successfully implemented a dynamic auto-scaling solution for our ECS tasks based on Kafka SumOffsetLag. By leveraging AWS MSK for Kafka message streaming and custom CloudWatch alarms, we built a system that automatically adjusts ECS tasks in real time, ensuring efficient and cost-effective processing.

AWS MSK and Kafka SumOffsetLag:

AWS MSK manages our Kafka clusters, ensuring scalability and reliability while reducing the operational complexity of infrastructure management. By monitoring the SumOffsetLag—the total number of unprocessed messages in Kafka—we gauge when to increase processing power or scale back resources.

Custom CloudWatch Alarms for Kafka Lag:

We use CloudWatch to monitor Kafka’s SumOffsetLag metric in real time. Through custom alarms, ECS task scaling actions are triggered automatically when message lag exceeds a predefined threshold. When the backlog is cleared, ECS tasks are scaled down, ensuring efficient resource utilization.

This solution seamlessly integrates AWS MSK’s Kafka management with ECS’s container orchestration capabilities, creating a scalable and resilient architecture.


The Benefits: Scalability, Efficiency, and Cost Optimization

  1. Optimized Resource Utilization and Cost Savings: Dynamic scaling ensures resources are allocated efficiently, minimizing costs during low traffic.

  2. Reduced Operational Overhead: Automation eliminates the need for manual intervention in scaling tasks.

  3. Increased System Resilience: Real-time scaling enhances system stability during traffic spikes.

  4. Improved Processing Times: Faster message processing improves loan approvals and customer satisfaction.

  5. Zero Downtime During Peak Periods: Scalable architecture ensures uninterrupted service during high-traffic events.


Conclusion: A Landmark Achievement for Capri Loans

The successful implementation of auto-scaling for ECS tasks based on Kafka SumOffsetLag with AWS MSK reflects Capri Loans’ commitment to innovation and operational excellence. This solution has transformed the way we process real-time financial data, delivering significant improvements in customer experience, cost management, and system reliability.

By dynamically adjusting to real-time data demands, we’ve optimized our infrastructure and set a new standard for how fintech organizations can leverage cloud technology to drive business success.

As Capri Loans continues to grow, we remain dedicated to enhancing our platform to meet the evolving needs of our customers and the financial services industry.