Bird
Raised Fist0
HLDsystem_design~7 mins

DDoS protection strategies in HLD - System Design Guide

Choose your learning style10 modes available
Problem Statement
When a service faces a sudden flood of fake traffic from many sources, it becomes overwhelmed and slows down or crashes. This attack, called Distributed Denial of Service (DDoS), makes the service unavailable to real users and can cause financial and reputational damage.
Solution
DDoS protection strategies work by detecting unusual traffic patterns and filtering out malicious requests before they reach the core service. They use layers of defense like traffic rate limiting, IP reputation checks, and traffic scrubbing through specialized networks to keep the service responsive and available.
Architecture
Internet /
Attackers
→CDN / WAF /
↓
Traffic Analysis &
Traffic Analysis &

This diagram shows how incoming internet traffic, including attack traffic, first passes through a CDN or Web Application Firewall (WAF) with DDoS filtering. Suspicious traffic is analyzed and limited before reaching the application servers.

Trade-offs
✓ Pros
→
Reduces service downtime by blocking malicious traffic early.
→
Improves user experience by allowing legitimate traffic through.
→
Scales to handle large attack volumes using cloud-based scrubbing.
→
Can integrate with existing infrastructure like CDNs and firewalls.
✗ Cons
→
Adds latency due to extra traffic inspection steps.
→
May block some legitimate users if detection rules are too strict.
→
Costs increase with higher traffic volumes and advanced filtering.
Use when your service faces or expects high-volume traffic spikes above thousands of requests per second, especially if exposed publicly on the internet.
Avoid if your service has very low traffic (under hundreds of requests per second) or is internal-only, where DDoS risk is minimal and added complexity is unnecessary.
Real World Examples
Netflix
Uses cloud-based DDoS protection integrated with their CDN to absorb and filter massive traffic spikes during popular show releases.
Amazon
Employs multi-layered DDoS defenses including AWS Shield and WAF to protect their e-commerce platform from large-scale attacks.
Cloudflare
Provides global DDoS mitigation by routing traffic through their network and filtering malicious requests before reaching customer servers.
Alternatives
Rate Limiting
Limits the number of requests per user or IP without full traffic scrubbing.
Use when: Choose when attacks are low volume or originate from few sources.
Anycast Network
Distributes traffic across multiple data centers to absorb attacks.
Use when: Choose when you have global infrastructure and want to spread attack load.
Blackhole Routing
Drops all traffic to a target IP during an attack, effectively making it unreachable.
Use when: Choose as a last resort when attack volume is too high to mitigate.
Summary
DDoS protection strategies prevent service outages caused by overwhelming fake traffic.
They filter and limit malicious requests before they reach core servers using multiple defense layers.
Choosing the right strategy depends on traffic scale, attack risk, and infrastructure capabilities.

Practice

(1/5)
1. Which of the following is a primary goal of DDoS protection strategies?
easy
A. Keep the service available during attack
B. Increase the number of incoming requests
C. Slow down legitimate user traffic
D. Disable firewalls to allow all traffic

Solution

  1. Step 1: Understand the purpose of DDoS protection

    DDoS protection aims to prevent attacks from making a service unavailable by handling malicious traffic.
  2. Step 2: Evaluate each option against this purpose

    Increasing requests or slowing legitimate traffic harms availability. Disabling firewalls reduces security. Only keeping service available matches the goal.
  3. Final Answer:

    Keep the service available during attack -> Option A
  4. Quick Check:

    DDoS protection = Keep service available [OK]
Hint: DDoS protection means keeping service up, not blocking all traffic [OK]
Common Mistakes:
  • Confusing DDoS protection with traffic blocking
  • Thinking DDoS protection increases traffic
  • Assuming firewalls should be disabled during attacks
2. Which component is commonly used to distribute incoming traffic and help mitigate DDoS attacks?
easy
A. Load balancer
B. Cache server
C. Database server
D. Application server

Solution

  1. Step 1: Identify components that manage traffic

    Load balancers distribute incoming requests across multiple servers to prevent overload.
  2. Step 2: Match component to DDoS mitigation role

    Load balancers help absorb and spread traffic, reducing attack impact. Other options do not distribute traffic.
  3. Final Answer:

    Load balancer -> Option A
  4. Quick Check:

    Traffic distribution = Load balancer [OK]
Hint: Load balancers spread traffic to avoid overload [OK]
Common Mistakes:
  • Confusing cache or database servers as traffic distributors
  • Thinking application servers handle traffic distribution
  • Ignoring the role of load balancers in DDoS defense
3. Consider a system using a CDN and a firewall with rate limiting. Which of the following best describes the request flow during a DDoS attack?
medium
A. Requests go directly to the origin server, bypassing CDN and firewall
B. CDN absorbs traffic, firewall filters requests, then origin server processes allowed requests
C. Firewall blocks all requests, CDN caches nothing
D. Origin server handles all requests before CDN and firewall

Solution

  1. Step 1: Understand CDN and firewall roles

    CDNs cache content and absorb traffic near users. Firewalls filter malicious requests before reaching origin.
  2. Step 2: Trace request flow during attack

    Requests first hit CDN, which reduces load. Firewall then filters suspicious traffic. Only allowed requests reach origin server.
  3. Final Answer:

    CDN absorbs traffic, firewall filters requests, then origin server processes allowed requests -> Option B
  4. Quick Check:

    Request flow = CDN -> Firewall -> Origin [OK]
Hint: Traffic flows CDN -> Firewall -> Origin server during attack [OK]
Common Mistakes:
  • Assuming requests bypass CDN or firewall
  • Thinking firewall blocks all requests indiscriminately
  • Believing origin server handles all traffic first
4. A system uses IP blacklisting to block attackers, but legitimate users are still affected. What is the likely issue?
medium
A. Firewall is disabled
B. Blacklist is empty, no IPs blocked
C. Blacklist is too broad, blocking shared IPs
D. System does not log blocked IPs

Solution

  1. Step 1: Analyze impact of IP blacklisting

    Blacklisting blocks specific IPs. If too broad, it may block IPs shared by many users.
  2. Step 2: Identify why legitimate users are affected

    Blocking shared IPs causes collateral damage to good users. Other options do not explain this effect.
  3. Final Answer:

    Blacklist is too broad, blocking shared IPs -> Option C
  4. Quick Check:

    Legitimate users blocked = Broad blacklist [OK]
Hint: Too broad blacklist blocks good users too [OK]
Common Mistakes:
  • Assuming empty blacklist blocks users
  • Ignoring shared IP usage in blacklisting
  • Thinking firewall status causes this issue
5. You design a DDoS protection system combining CDN, rate limiting, and real-time traffic analysis. Which approach best balances user experience and attack mitigation?
hard
A. Apply strict rate limits globally, blocking many users during spikes
B. Allow all traffic and rely on origin server capacity
C. Disable CDN and rely only on manual IP blocking
D. Use CDN to absorb traffic, apply adaptive rate limits based on analysis, and alert admins on anomalies

Solution

  1. Step 1: Evaluate each strategy's impact on users and attack defense

    Strict global limits block many users, hurting experience. Disabling CDN or manual blocking is slow and risky.
  2. Step 2: Identify balanced approach

    Using CDN to absorb traffic reduces load. Adaptive rate limits adjust to traffic patterns, minimizing false blocks. Real-time alerts enable quick response.
  3. Final Answer:

    Use CDN to absorb traffic, apply adaptive rate limits based on analysis, and alert admins on anomalies -> Option D
  4. Quick Check:

    Balanced DDoS defense = CDN + adaptive limits + alerts [OK]
Hint: Combine CDN, adaptive limits, and alerts for best balance [OK]
Common Mistakes:
  • Applying strict limits without adaptation
  • Ignoring CDN benefits
  • Relying only on manual blocking or server capacity
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard