Rate Limiting to Defend Applications from DoS
Rate limiting controls how much traffic an application accepts over a fixed period, reducing load from abusive requests, resource exhaustion, and application-layer denial of service attacks. It is one layer in a broader resilience plan supported by edge filtering, capacity planning, monitoring, and tested incident procedures. Volumetric floods also require upstream traffic scrubbing and sufficient capacity.
For Australian teams, the aim is to protect availability without blocking legitimate customers. Account for different cities, mobile networks, shared business connections, and seasonal peaks such as retail events or end-of-financial-year reporting. Use measured traffic rather than another company’s configuration.
The strongest controls combine coarse edge policies with precise application quotas, safe rejection responses, and continuous refinement. This guide explains how to design them for internet-facing services while preserving a reliable user experience across distributed infrastructure.
Start with coarse edge limits
Start with coarse request limits at the CDN, load balancer, or web application firewall so obvious spikes do not consume application resources. Edge policies should protect the origin without becoming the only defence, while network operators provide scrubbing for floods larger than the application can absorb.
Enforce additional limits at the API gateway, reverse proxy, or service middleware. Cover endpoints and supporting tasks such as authentication, report generation, webhooks, and background jobs. Centralised policy improves consistency across containerised services, and failover nodes need enough shared state to agree on active limits.
Build limits around identity and risk
Do not rely on IP addresses alone. NAT, mobile carrier routing, and shared offices can place many valid users behind one address, while botnets rotate addresses quickly. Combine IP limits with account, API key, session, device, and token limits. Trust forwarded IP headers only from known proxies.
Give sensitive actions stricter thresholds than ordinary reads. A password-reset endpoint, search function, or data export may consume more capacity than a static page. Use separate buckets for user roles so one abusive client cannot exhaust a shared customer quota, and apply stricter limits to new or suspicious accounts.
Choose token buckets and sliding windows
A token bucket works when short bursts are legitimate but sustained traffic is not. Tokens refill at a defined rate, each request spends one, and bucket size controls the permitted burst. APIs can absorb ordinary spikes while imposing a predictable sustained rate.
Sliding-window counters suit steadier limits over a recent period. Calculate thresholds from measured baseline traffic and available headroom, then test them against peak usage. Avoid arbitrary figures that punish customers during legitimate campaigns or service migrations.
Send safe retry signals
Return HTTP 429 when a caller exceeds a quota, and include Retry-After or standard rate-limit headers where supported. Keep the response brief so rejected requests do not create another expensive workload. A clear status stops many clients from retrying aggressively.
Clients should use exponential backoff with jitter and stop after a sensible retry limit. Distributed systems also need idempotency keys so a delayed retry cannot duplicate a payment or order. Publish limits in API documentation so integration teams can distinguish a quota response from an application failure.
Protect shared and costly resources
Rate limits must protect shared databases, connection pools, queues, and CPU-intensive code. Add concurrency caps, upstream timeouts, circuit breakers, and bounded queues so excess work is rejected rather than stored until the system collapses. Cache repeatable responses and defer nonessential jobs under pressure.
For organisations supporting mining operations in Western Australia or Queensland, remote connectivity makes recovery harder. Teams can compare their controls with mining security guidance while testing how limits behave over intermittent links. Perth and Kalgoorlie sites should retain core functions when external connectivity is unavailable.
Test with realistic Australian traffic
Test each limit in a controlled environment before deployment. Establish normal request rates, peak concurrency, and costly endpoint usage, then replay representative traffic at higher volume. Include sudden bursts, slow requests, malformed parameters, and requests spread across many source addresses.
Account for Australia’s geography and network conditions. A request over a regional NBN connection may have more latency or instability than one from a metropolitan Sydney or Melbourne user, while mobile failover can change client IPs. Observe false positives and customer impacts rather than chasing one laboratory number; a “she’ll be right” attitude to capacity planning is no defence.
Monitor, alert, and refine
Monitor accepted, rejected, and retried requests alongside CPU, memory, database saturation, queue depth, and upstream latency. Alert on sustained 429s and sudden 5xx increases, since either can reveal a tuning fault or active abuse. Keep rate-limit configuration in version control and review changes with security teams.
Link gateway logs to your SIEM and threat-intelligence workflow so repeated attacks can be correlated across services. Document who can change thresholds, how emergency overrides work, and when an incident commander should loosen limits during a genuine outage. For APRA-regulated Australian institutions, align availability controls with CPS 230 operational-risk requirements. Penetration tests should include rate-limit bypass and resource-exhaustion scenarios.
Infoziant Security helps teams review application traffic, identify expensive endpoints, and design layered limits with safe 429 responses and monitoring. Its services include 24/7 managed monitoring, penetration testing, and cloud and mobile security assessments. Request a free VAPT report or start a trial-based engagement to turn the findings into tested controls for application availability.