Cloud Native 14 min read

Why the Financial Platform “Huanbei” Switched from Spring Cloud Gateway to Apache APISIX: Architecture, Implementation, and Benefits

The article explains the specific stability, regulatory, and precision requirements of financial software, examines Java's role in the sector, describes the shortcomings of Spring Cloud Gateway, and details how Apache APISIX was adopted, deployed, customized, and evaluated to improve performance, cost, and operational efficiency in a cloud‑native environment.

Wukong Talks Architecture
Wukong Talks Architecture
Wukong Talks Architecture
Why the Financial Platform “Huanbei” Switched from Spring Cloud Gateway to Apache APISIX: Architecture, Implementation, and Benefits

Financial applications have unique demands such as high stability, strict regulatory compliance, and precise data handling, which influence system design, data‑center topology, and middleware selection.

Java dominates Chinese financial systems because of its extensive ecosystem and mature tooling, but in a cloud‑native era its relatively low performance, higher resource consumption, and garbage‑collection model can become bottlenecks for high‑QPS services.

Huanbei, a consumer‑credit platform built on a Java stack, originally used three gateway solutions (Spring Cloud Gateway for entry/exit gateways and OpenResty for business gateways). Growing traffic caused memory leaks and CPU spikes, prompting a migration to Apache APISIX.

After the migration, the architecture was simplified: a single APISIX instance handles inbound traffic, forwards requests via service discovery to backend services, and falls back to an internal K8s Ingress when discovery fails. The external gateway is consolidated outside the K8s cluster with a front‑facing SLB.

Deployment is performed with Docker images: a base APISIX image is extended with custom Lua code and configuration files. The Dockerfile used is:

FROM registry.xxx.net:5001/apisix-shuhe:v1.5
ENV APP_NAME={{APP_NAME}}
COPY {{PRODUCT_FILE}} /tmp/deploy2/artifact.tar.gz
RUN mkdir /tmp/deploy/ && tar -xf /tmp/deploy2/artifact.tar.gz -C /tmp/deploy/ && \
    cp -R /tmp/deploy/apisix/ /usr/local/apisix/ && \
    cp /tmp/deploy/bin/apisix /usr/bin/apisix && \
    cp /tmp/deploy/conf/apisix-$APP_NAME.yaml /usr/local/apisix/conf/apisix.yaml && \
    cp /tmp/deploy/conf/config-$APP_NAME.yaml /usr/local/apisix/conf/config.yaml && \
    set -x && \
    bin='#! /usr/local/openresty/luajit/bin/luajit\npackage.path = "/usr/local/apisix/?.lua;" .. package.path' && \
    sed -i "1s@.*@$bin@" /usr/bin/apisix && \
    rm -rf /tmp/*

The Nginx template is also customized to switch log storage between local files and Syslog/Fluentd based on the selected profile, and to inject environment variables and shared‑dict definitions.

To reduce configuration duplication, Huanbei integrated gateway whitelist management with its permission system, allowing a single source of truth for API access control.

Custom plugins were developed for logging, traffic gray‑release, and other business‑specific needs, leveraging APISIX’s extensible Lua framework.

Performance tests showed APISIX handling up to 80 K QPS on a 4‑core VM, delivering a >30% throughput improvement over Spring Cloud Gateway. The platform also benefited from APISIX’s rich plugin ecosystem, which covered authentication, observability, service discovery, rate limiting, and both L4/L7 traffic routing.

Cost analysis revealed a ~60% reduction in required servers after migration, and the unified technology stack lowered development and maintenance effort.

From a developer’s perspective, APISIX offers lower learning and maintenance overhead compared to OpenResty, faster feature implementation via plugins, and powerful logging and dynamic debugging that accelerate issue resolution.

Overall, the shift illustrates how financial services are moving from rapid, heterogeneous deployments toward standardized, cost‑effective, cloud‑native architectures that prioritize stability, observability, and scalability.

JavaCloud NativeMicroservicesAPI gatewaySpring Cloud Gatewayfinancial servicesApache APISIX
Wukong Talks Architecture
Written by

Wukong Talks Architecture

Explaining distributed systems and architecture through stories. Author of the "JVM Performance Tuning in Practice" column, open-source author of "Spring Cloud in Practice PassJava", and independently developed a PMP practice quiz mini-program.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.