Improve API Latency by 50% from API Gateway Migration

The migration from our custom-built Node.js and Express-based API Gateway to KrakenD has resulted in significant improvements in performance, scalability, and resource efficiency. By adopting KrakenD, we achieved a substantial reduction in latency, with response times improving by approximately 50%, from 200-250ms down to 100-150ms. This has directly contributed to faster processing times, enhanced reliability, and a better overall experience for our customers.

Beyond performance improvements, the migration led to notable infrastructure optimizations. We reduced our resource usage from over 40 pods to just 12, resulting in a more efficient and streamlined architecture. This also generated monthly cost savings of approximately $1,500, as we were able to better manage our resource utilization and scale more effectively. Here’s how..

Introduction

At Xendit, we always strive to give the best experience to our merchants based on their business needs. During the early phase of our growth, we needed to offer flexibility and control and hence, our platform initially utilized a custom-built API gateway developed with Node.js and Express. However, as our system evolved and demand for our services increased, we began to encounter challenges with our custom gateway. As the platform grew, maintaining scalability, managing the complexity of APIs, and ensuring resilience against errors became progressively challenging.

The custom gateway required significant effort to implement advanced features like rate limiting, caching, and flexibility of adding new rules without impacting existing dependencies. Additionally, the manual work involved in integrating new endpoints and scaling the gateway to handle higher traffic loads resulted in a growing maintenance burden and higher cost and resources.

To address these challenges, we started exploring alternatives that could meet our growing demands without sacrificing performance or flexibility. After thorough evaluation, we selected KrakenD, an open-source fastest, stateless, distributed and high performance API gateway. For its high performance, declarative configuration model, and seamless integration with modern architectures. KrakenD offered built-in support for features we previously had to develop manually, along with a strong focus on scalability and observability.

This migration has been a pivotal step in modernizing our API infrastructure, enabling us to better support our growing ecosystem and deliver a more efficient experience for developers and users alike.

Challenges with custom-built API Gateway

Xendit operates multiple gateways given on different platforms, policies, and data compliance. Therefore, in the early days we developed different gateways for similar purposes. Hence duplication, redundancies, extended development time, and lack of a unified standard posed significant challenges. Multiple gateways operated independently, each with its own domain, prerequisites, and processes, while all shared the common purpose of acting as intermediaries between clients and upstream services.

Establishing a unified standard for all gateways was a complex and resource-intensive process.

Implementing a new authorization standard across all gateways highlighted these challenges. When a centralized authorization mechanism was introduced to address product permissioning, every gateway team had to align with the standard, coordinate with the authorization team, and ensure successful implementation. This process revealed several pain points:

These issues were compounded by inconsistencies in how different gateways approached API implementation, standards, and service-level agreements (SLAs), further underscoring the need for a unified solution.

Why KrakenD Stood Out

KrakenD is a high-performance, open-source community driven API Gateway designed for scalability, flexibility, and ease of use. It simplifies API management with a declarative configuration system using JSON or YAML, enabling rapid deployment and customization. KrakenD comes equipped with powerful built-in features such as rate limiting, circuit breaking, caching, and plugin extensibility, allowing seamless adaptation to complex requirements.

When evaluating KrakenD as our API Gateway solution, several key factors influenced the decision: