Cloud Native 6 min read

How to Strategically Apply Rate Limiting Across SLB, Nginx, and Spring Cloud Gateway

This article explains the principles and practical steps for implementing rate limiting at the SLB, Nginx/Kong, Spring Cloud Gateway, and Java microservice layers, covering traffic characteristics, interception rules, configuration methods, and isolation techniques to protect cloud‑native systems.

ITFLY8 Architecture Home
ITFLY8 Architecture Home
ITFLY8 Architecture Home
How to Strategically Apply Rate Limiting Across SLB, Nginx, and Spring Cloud Gateway

The guiding principle of rate limiting is to restrict traffic as close to the source as possible, using the skills and tools available to the team.

SLB Node

All external traffic—business, non‑business, DDoS, normal requests, crawlers—passes through the SLB entry point, so it should be the first place to intercept unwanted flows.

Intercepted traffic: DDoS attacks, generic unsafe traffic such as SQL injection and XSS.

Rate‑limiting measures: connection concurrency limits, per‑IP request limits, crawler throttling.

Because SLB configuration is UI‑based and not easily version‑controlled, many teams move these rules to downstream Nginx/Kong where they can be stored as code and restored quickly with scripts.

Nginx/Kong Node

After SLB, most malicious traffic (DDoS, common injections) is already filtered, but crawlers and some advanced attacks may remain.

Rate‑limiting actions: throttle crawlers, control concurrency, filter or redirect to a honeypot system, per‑IP request limits.

Spring Cloud Gateway Node

This layer handles dynamic Java traffic, which has a lower capacity than Nginx, requiring more granular controls.

Normal rate limiting.

Burst traffic control (e.g., flash‑sale spikes).

CC attack and signature verification filtering.

Dynamic routing can configure individual rate‑limit rules and custom CC+signature checks.

Isolation is crucial because the gateway forwards requests to many microservices; a single slow service should not affect others.

Techniques: circuit breakers such as Hystrix, Sentinel, or Guava.

Differences Between Nginx and Gateway Rate Limiting

Nginx thresholds are higher because it serves a broader range of traffic, including static H5 resources.

Gateway rate limiting is more flexible, allowing custom KeyResolvers for dimensions like user ID, IP, tenant, etc.

Java Microservice Node

Each microservice’s capacity can be measured (e.g., with JMeter) and used to set appropriate limits.

Additional dimensions: per‑service limits, queue‑based throttling, dedicated thread pools for inbound and outbound calls to avoid cross‑service impact.

Circuit breaking ensures that slow downstream services do not drag down the caller.

Overall, combining proper rate limiting, isolation, and circuit‑breaker strategies across these layers helps maintain stability and security in cloud‑native architectures.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Microservicesgatewayrate limitingSLB
ITFLY8 Architecture Home
Written by

ITFLY8 Architecture Home

ITFLY8 Architecture Home - focused on architecture knowledge sharing and exchange, covering project management and product design. Includes large-scale distributed website architecture (high performance, high availability, caching, message queues...), design patterns, architecture patterns, big data, project management (SCRUM, PMP, Prince2), product design, and more.

0 followers
Reader feedback

How this landed with the community

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.