Main article Short / Reel

How to Protect a Website from 400,000 Requests per Second: DDoS and Bot Defense Explained

What happens when a website built to handle 5,000 requests per second faces 400,000 incoming requests? Learn how edge protection, WAF rules, rate limiting, bot detection, browser challenges, and application-level safeguards work together to reduce malicious traffic without unnecessarily blocking legitimate users.

Open original source Tap anywhere on the page to unmute (browser policy)

Imagine a website that can process 5,000 requests per second suddenly receiving 400,000 requests per second. The problem is not simply a spike in traffic. Malicious requests can consume application resources, exhaust database connections, increase latency, and prevent legitimate customers from using the service.

How can the website remain available? The answer is not a single rule that blocks IP addresses. It is a layered defense strategy that combines network and edge protection, rate limiting, bot detection, and safeguards for sensitive application endpoints.

Understanding the 400,000-Requests-per-Second Scenario

Suppose, for illustration, that an application can process 5,000 requests per second while 400,000 requests arrive every second. That is 80 times the assumed application capacity. If all requests reach the origin server, queues may grow, database connections may become exhausted, response times may increase, and legitimate users may experience failures.

These figures are illustrative, not verified benchmark results or a guarantee of how a particular website will behave. Actual outcomes depend on request types, infrastructure capacity, caching, defense rules, and the characteristics of the attack.

Layer One: Network and Edge Protection

Whenever possible, malicious traffic should be detected and mitigated before most of it reaches the application server. Appropriate network and edge services can absorb or filter certain types of hostile traffic, depending on their capabilities and configuration.

  • Choose DDoS protection appropriate to the website's risk and traffic profile.
  • Use Web Application Firewall (WAF) rules to block known malicious request patterns.
  • Reduce unnecessary traffic reaching the origin server.
  • Restrict direct access to the origin so attackers cannot easily bypass the protection layer.

This matters because application-level checks may come too late if network capacity or server resources are already exhausted.

Layer Two: Rate Limiting

Rate limiting restricts how many requests a source can make within a defined period. For example, a website may apply limits to login attempts, search endpoints, or order creation while allowing normal browsing to continue.

IP-based limits alone are insufficient. Attackers may distribute traffic across many IP addresses, while legitimate users may share one public address through a corporate network or an internet provider.

  • Set different limits for different API routes and operations.
  • Use account or session identity where appropriate, rather than relying only on IP addresses.
  • Apply stricter controls to expensive or abuse-prone operations.
  • Return a suitable response, such as HTTP 429, when a limit is exceeded.
  • Monitor the impact of each rule to avoid unnecessarily blocking legitimate users.

Layer Three: Bot Detection and Behavioral Analysis

Not every automated request is malicious, and not every request that looks unusual comes from a bot. Effective detection uses multiple signals rather than relying on a single indicator.

  • Request frequency and timing patterns.
  • Navigation patterns across pages and endpoints.
  • Repeated attempts to access sensitive functions.
  • Browser and session signals that can be validated appropriately.
  • Source reputation and risk signals available from the protection provider.

These signals can inform whether to allow a request, require additional verification, apply a stricter rate limit, or block confirmed malicious traffic. However, no method perfectly distinguishes every bot from every human. Legitimate bots exist, and defensive systems can incorrectly classify real users.

Layer Four: Browser Verification Challenges

Some protection systems ask a client to complete a verification step that demonstrates it can perform a particular browser-side operation. This can reduce certain simple automated requests, but it is not a complete defense against every attack.

Consider accessibility, low-bandwidth mobile devices, browsers with JavaScript disabled, and legitimate clients that call an API directly. Passing a challenge does not make every subsequent request safe, so rate limits and access controls must remain in place.

Layer Five: Application and Database Safeguards

Even with an external protection service, the application must be designed to handle load efficiently. Expensive or unbounded operations can exhaust resources even when traffic levels are not exceptionally high.

  • Cache suitable pages and data.
  • Avoid expensive database queries for unnecessary requests.
  • Use background queues for tasks that do not need to run synchronously.
  • Set limits on request sizes, pagination, and search operations.
  • Protect login, password recovery, registration, and order creation from abuse.
  • Monitor CPU, memory, database connections, latency, and error rates.

For Laravel applications, middleware can enforce rate limits, while caching and queues can improve application efficiency. Server and database configuration should also match expected demand. These measures complement, rather than replace, network-level mitigation for large traffic floods.

What If the Attacker Keeps Changing IP Addresses?

If every IP address sends only one request, a simple per-IP limit may never trigger, even though the combined traffic volume is enormous. The defense must therefore consider aggregate traffic patterns, edge-level signals, client behavior, account or session limits, and protection for resource-intensive endpoints.

There is no universal rule such as ten requests per second per IP that works for every website. Appropriate limits depend on the endpoint and operation. Public pages, login forms, payment flows, and order creation should not necessarily share the same policy.

How to Test Your Protection

Enabling security settings is not proof that they work. Test systems you own or are explicitly authorized to assess, and measure the results from the perspective of legitimate users.

  • Test expected, normal traffic patterns.
  • Verify rate-limit behavior on test endpoints or in a controlled environment.
  • Check that legitimate users are not blocked unnecessarily.
  • Measure latency, error rates, and resource consumption.
  • Confirm that the origin server cannot be accessed directly to bypass the edge layer.
  • Review security events and blocking rules after each test.

Do not run large-scale flooding or stress tests against networks you do not own or have permission to test. Controlled performance tests should stay within an agreed scope and defined limits.

Conclusion: Effective Protection Uses Multiple Layers

There is no single rule that guarantees availability during a flood of malicious requests. A stronger strategy combines network and edge DDoS mitigation, WAF rules, rate limiting, bot detection, additional verification where appropriate, application and database optimization, continuous monitoring, and safe testing.

The goal is not simply to block as many requests as possible. It is to reduce malicious traffic while keeping legitimate customers able to use the service.

Read next

Related articles

All articles →