Design a DDoS Mitigation Service

Hard45 min
1 / 30
System design answer

Design a DDoS Mitigation Service

Hard45 min30 sections
understanding•10 min read

Problem Statement: A Multi-Layer Defense Against Denial of Service

Frames DDoS mitigation as a real-time, multi-layer filtering problem spanning L3/L4 volumetric defense and L7 application defense.

Problem statement

Design a DDoS mitigation service that detects abnormal traffic surges, distinguishes attack traffic from legitimate users, and applies countermeasures — blackhole routing, rate limiting, SYN cookies, challenges, or scrubbing — while legitimate traffic keeps flowing with minimal added latency. The service must protect customer prefixes and applications whether the attack is a 2 Tbps volumetric UDP flood, a TCP state-exhaustion SYN flood, or a 300 million request-per-second HTTP/2 campaign.

Distributed denial-of-service is distinctive because the adversary is volumetric, distributed, and adaptive . NETSCOUT's ATLAS telemetry recorded roughly 16 million DDoS attacks in a single recent year, and single attacks have crossed the 2.5 Tbps mark — Akamai publicly reported mitigating a 2.52 Tbps multi-vector attack against a European financial institution in early 2024. Cloudflare has publicly reported blocking HTTP/2 Rapid Reset attacks at roughly 398 million requests per second. Google Cloud Armor reported stopping a 46 million request-per-second Layer-7 attack in June 2022. These are not theoretical numbers; they define the envelope a serious design must address.

Why the problem is hard

A normal backend can shed load and retry. A mitigation service cannot simply retry: while it hesitates, the customer's origin is saturated, TCP connection tables fill, and revenue stops. The design therefore separates three concerns that many candidates blur together:

  1. Detection — noticing abnormal traffic fast enough that damage is bounded. Detection spans flow telemetry at the network edge, per-packet heuristics in the datapath, and application-layer behavioral analytics.
  2. Classification — deciding what kind of attack is underway (volumetric, protocol, application layer) and which source populations are abusive, with minimal false positives against real users.
  3. Enforcement — applying countermeasures in the right place: at the edge router via blackhole or Flowspec, at a scrubbing center via deep inspection, or at the application layer via challenges and rate limits.

The problem requires real-time monitoring and anomaly detection, automated blacklisting or rate limiting of suspicious IPs, optional scrubbing centers, and integration with existing load balancers or CDNs. The four non-functional requirements — throughput for large volumetric attacks, minimal false positives, low-latency rule application, and global presence for near-source mitigation — each drive a separate architectural subsystem.

The three defense planes

  1. Network plane (L3/L4): anycast absorption, SYN cookies, UDP reflection filtering, RTBH blackhole routing, BGP Flowspec, and GRE diversion to scrubbing centers.
  2. Application plane (L7): request-rate baselining, header and TLS fingerprinting, JavaScript or cryptographic challenges, token-bucket rate limits, and rule-based blocking at edge proxies.
  3. Control plane: detection pipelines, policy management, rule distribution, incident orchestration, customer reporting, and the telemetry lake that powers all of it.

A strong answer keeps these planes separate. The network plane must keep filtering even if the control plane is degraded; the control plane must keep learning even while a record attack is in progress; and the application plane must never be starved by volumetric noise that should have been absorbed earlier.

Key terminology

  • Volumetric attack: saturates bandwidth (UDP floods, amplification/reflection attacks such as DNS, NTP, CLDAP, and memcached, which reached a documented 51,000x amplification factor in the 2018 GitHub attack).
  • Protocol attack: exhausts stateful resources — SYN floods, ACK floods, connection-table exhaustion, slowloris-style connection holding.
  • Application-layer attack: exhausts application logic — HTTP floods, Rapid Reset (CVE-2023-44487), cache-busting queries, expensive-endpoint hammering.
  • Scrubbing center: a facility where all traffic for a prefix is diverted (typically via BGP), malicious traffic is discarded after deep inspection, and clean traffic is re-injected, often through GRE tunnels.

Key Highlights

  • •Attacks span three classes — volumetric, protocol, and application layer — and each class demands a different detection and enforcement mechanism.
  • •Published records set the envelope: multi-Tbps volumetric attacks and hundreds of millions of requests per second at L7.
  • •Detection, classification, and enforcement are separate subsystems with different latency and consistency requirements.
  • •The network plane must function even when the control plane is degraded; filtering cannot depend on a slow analytics RPC.
  • •False positives are the hidden cost: blocking real users is often worse than a short attack.
Lead With the Plane Separation
State in the first two minutes that volumetric traffic is absorbed at the network edge, application floods are handled at the proxy layer, and a control plane coordinates both. This instantly separates a security-minded answer from a generic load-balancer answer.
Do Not Answer 'Just Use a CDN'
A CDN helps with L7 absorption but does nothing for a 2 Tbps UDP flood against an unprotected prefix. The brief explicitly asks for blackhole routing, rate limiting, and scrubbing — name them.

Section Rescue Kit

Buzzwords to use:

Amplification AttackAnycast Absorption

Safe statements:

  • "Let me separate detection, classification, and enforcement first, because they have very different latency budgets."
  • "Before choosing technology, I will define which decisions must happen in the datapath and which can wait for the control plane."
Design a DDoS Mitigation Service - System Design | WinJob | WinJob