To throttle requests in Java, choose where the limit belongs: use a gateway to control incoming API traffic across routes, or an application-level limiter such as Resilience4j to regulate work inside a service. In either case, define what counts as a caller, how much short-term bursting to allow, and whether excess requests should be rejected or delayed.
Choose where throttling belongs
Rate limiting controls how often a caller can perform an operation. A gateway can enforce policy before requests reach application code; an in-process limiter can control calls or operations within a Java application. These approaches solve related but different problems.
| Approach | What it controls | Important design choice |
|---|---|---|
| Spring Cloud Gateway WebFlux Redis RateLimiter | Incoming gateway requests, using a token bucket configured by replenish rate, burst capacity, and requested tokens. Denial returns HTTP 429 by default. | Choose a key resolver and account for where quota state is maintained. |
| Spring Cloud Gateway WebFlux Bucket4j integration | Gateway requests through a Bucket4j rate-limit filter. | Select persistence appropriate to the deployment; the documented Caffeine example is a local in-memory cache and is not recommended for production. |
| Spring Cloud Gateway MVC Bucket4j filter | Requests in an MVC gateway routing context, with bucket capacity, period, token cost, and a key resolver. | Determine the per-key policy and where bucket state lives. |
| Resilience4j RateLimiter | Application-level operations, using configured time cycles and permission counts. | Decide whether callers can wait for a permission or excess calls should be rejected. |
Gateway integrations differ between WebFlux and MVC. Check the documentation matching the Gateway variant and version used by the project; the cited Spring pages are for version 5.0.3.
Set the quota and burst behavior
Spring Cloud Gateway WebFlux Redis
The WebFlux RequestRateLimiter documentation describes a token bucket: “The algorithm used is the Token Bucket Algorithm.” The bucket’s capacity and refill rate are separate controls. replenishRate is the token refill rate, burstCapacity is the maximum number of tokens stored, and requestedTokens is the cost of a request (default 1).
#1 Best Overall
- 【Five Gigabit Ports】1 Gigabit WAN Port plus 2 Gigabit WAN/LAN Ports plus 2 Gigabit LAN Port. Up to 3 WAN ports optimize bandwidth usage through one device.
- 【One USB WAN Port】Mobile broadband via 4G/3G modem is supported for WAN backup by connecting to the USB port. For complete list of compatible 4G/3G modems, please visit TP-Link website.
- 【Abundant Security Features】Advanced firewall policies, DoS defense, IP/MAC/URL filtering, speed test and more security functions protect your network and data.
- 【Highly Secure VPN】Supports up to 20× LAN-to-LAN IPsec, 16× OpenVPN, 16× L2TP, and 16× PPTP VPN connections.
- Security - SPI Firewall, VPN Pass through, FTP/H.323/PPTP/SIP/IPsec ALG, DoS Defence, Ping of Death and Local Management. Standards and Protocols IEEE 802.3, 802.3u, 802.3ab, IEEE 802.3x, IEEE 802.1q
- Set
replenishRateto the ongoing allowance you want to restore over time. - Set
burstCapacityto the largest temporary burst the bucket may hold. A larger value allows more requests close together, but does not increase the ongoing refill rate. - Use
requestedTokenswhen operations have different costs; a request consumes that many tokens.
When replenish rate and burst capacity are equal, the configuration gives a steady allowance without additional stored burst capacity. A larger burst capacity permits temporary bursts.
Spring Cloud Gateway Bucket4j
For the documented WebFlux Bucket4j integration, capacity sets bucket size, while refillPeriod and refillTokens describe replenishment. requestedTokens sets the cost of each request. The documentation’s Caffeine example is a local cache, not shared quota state across gateway instances. Independent process-local states do not automatically coordinate a single shared limit.
Rank #2
- DUAL-BAND WIFI 6 ROUTER: Wi-Fi 6(802.11ax) technology achieves faster speeds, greater capacity and reduced network congestion compared to the previous gen. All WiFi routers require a separate modem. Dual-Band WiFi routers do not support the 6 GHz band.
- AX1800: Enjoy smoother and more stable streaming, gaming, downloading with 1.8 Gbps total bandwidth (up to 1200 Mbps on 5 GHz and up to 574 Mbps on 2.4 GHz). Performance varies by conditions, distance to devices, and obstacles such as walls.
- CONNECT MORE DEVICES: Wi-Fi 6 technology communicates more data to more devices simultaneously using revolutionary OFDMA technology
- EXTENSIVE COVERAGE: Achieve the strong, reliable WiFi coverage with Archer AX1800 as it focuses signal strength to your devices far away using Beamforming technology, 4 high-gain antennas and an advanced front-end module (FEM) chipset
- OUR CYBERSECURITY COMMITMENT: TP-Link is a signatory of the U.S. Cybersecurity and Infrastructure Security Agency’s (CISA) Secure-by-Design pledge. This device is designed, built, and maintained, with advanced security as a core requirement.
The WebFlux documentation notes that Bucket4j requires Bucket4j core plus a persistence option. Choose storage based on whether quotas must be shared among instances, and verify its operational and consistency characteristics.
Spring Cloud Gateway MVC
The MVC rate-limit filter documentation shows a Bucket4j filter configured with bucket capacity, a period, token cost, and a key resolver. Capacity and period define the allowance and regeneration interval. Map these settings to the MVC gateway’s actual routing and state-storage requirements rather than assuming WebFlux configuration applies unchanged.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #3
- 【Flexible Port Configuration】1 2.5Gigabit WAN Port + 1 2.5Gigabit WAN/LAN Ports + 4 Gigabit WAN/LAN Port + 1 Gigabit SFP WAN/LAN Port + 1 USB 2.0 Port (Supports USB storage and LTE backup with LTE dongle) provide high-bandwidth aggregation connectivity.
- 【High-Performace Network Capacity】Maximum number of concurrent sessions – 500,000. Maximum number of clients – 1000+.
- 【Cloud Access】Remote Cloud access and Omada app brings centralized cloud management of the whole network from different sites—all controlled from a single interface anywhere, anytime.
- 【Highly Secure VPN】Supports up to 100× LAN-to-LAN IPsec, 66× OpenVPN, 60× L2TP, and 60× PPTP VPN connections.
- 【5 Years Warranty】Backed by our 5-years warranty and free technical support from 6am to 6pm PST Monday to Fridays
Resilience4j
Resilience4j’s RateLimiter documentation describes permissions granted in configured cycles. Set the cycle and permission count to match the operation’s intended quota, then decide how callers behave when permissions are unavailable: reject excess calls, wait for a later permission, or use a combination of these approaches.
Choose a caller key deliberately
A limiter needs a key to group requests into buckets or quotas. Spring Cloud Gateway provides a key resolver; its MVC documentation identifies the principal as a common choice. Use an authenticated principal or another server-controlled identity when the policy is per user or client and the application has a suitable identity available.
Rank #4
- Next-Gen Gigabit Wi-Fi 6 Speeds: 2402 Mbps on 5 GHz and 574 Mbps on 2.4 GHz bands ensure smoother streaming and faster downloads; support VPN server and VPN client¹
- A More Responsive Experience: Enjoy smooth gaming, video streaming, and live feeds simultaneously. OFDMA makes your Wi-Fi stronger by allowing multiple clients to share one band at the same time, cutting latency and jitter.²
- Expanded Wi-Fi Coverage: 4 high-gain external antennas and Beamforming technology combine to extend strong, reliable, Wi-Fi throughout your home.
- Improved Battery Life: Target Wake Time helps your devices to communicate efficiently while consuming less power.
- Improved Cooling Design: No heat ups, no throttles. A larger heat sink and redefined case design cools the WiFi 6 system and enables your network to stay at top speeds in more versatile environments.
A client-controlled query parameter is not a dependable production identity: callers may choose or spoof it. The older WebFlux reference explicitly labels its query-parameter example as not recommended for production. Also decide how the gateway should handle unresolved keys. The WebFlux documentation denies requests with a missing key by default; key resolution and empty-key policy should be configured intentionally.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Decide how excess requests should be handled
Spring Cloud Gateway returns HTTP 429 by default when a rate limiter denies a request, though configuration can change response behavior. A rejection is appropriate when the caller should retry later or when waiting would tie up resources. Resilience4j also supports waiting behavior; use it only where the caller’s latency budget and the application’s execution model can tolerate delay.
Recommended Free Tools
Best Value
- Dual band router upgrades to 1200 Mbps high speed internet (300mbps for 2.4GHz plus 900Mbps for 5GHz), reducing buffering and ideal for 4K stream
- Full Gigabit Ports - Gigabit Router with 4 Gigabit LAN ports, ideal for any internet plan and allow you to directly connect your wired devices
- Boosted Coverage - Four external antennas equipped with Beamforming technology extend and concentrate the Wi-Fi signals
- MU-MIMO technology - (5GHz band) allows high speeds for multiple devices simultaneously
- Access Point Mode - Supports AP Mode to transform your wired connection into wireless network, an ideal wireless router for home
- Use prompt rejection when excess work should not accumulate, and ensure clients can handle the denial response.
- Allow waiting only when delaying the operation is acceptable and callers will not wait beyond their useful deadline.
- Keep gateway response policy distinct from an application-level limiter’s caller behavior; configuring one does not automatically define the other’s response.
Implementation checklist
- Identify the boundary to protect: incoming routes suggest a gateway limiter; work inside a service suggests an application-level limiter.
- Choose the Gateway variant, if applicable, and consult documentation matching the project’s Spring Cloud Gateway and Spring Boot versions. Configuration properties and dependency compatibility can change.
- Select a stable, server-controlled key that matches the quota’s scope, such as an authenticated principal where appropriate.
- Define the ongoing rate, burst capacity, and per-request token cost. For Bucket4j, specify capacity and refill settings.
- Decide whether state must be shared across instances. Do not treat a local in-memory cache as a distributed quota store.
- Specify what callers experience at the limit: typically a 429 at the gateway by default, or a rejection or wait decision for Resilience4j.
- Check missing-key behavior and response configuration, then verify the chosen integration against the framework version actually deployed.
The Spring Cloud Gateway sources cited here describe version 5.0.3; the Resilience4j documentation cited here does not expose a page version. Their example values are configuration illustrations, not performance benchmarks.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

