KatInterview

Global Edge Abuse-IP Filtering with Fast Rollback

System DesignModel answer
HardModel answerSystem Designsystem-designdistributed-systemsedge-computing

Last updated

Design a worldwide edge service that scores client IPs per request, shares abuse signals between regions within seconds, and can undo bad blocklist changes in under ten seconds.

Problem

You operate a large internet-facing platform with edge locations spread around the world. Attackers running credential stuffing, scraping, and DDoS campaigns cycle through source IPs quickly. Design a service that inspects every inbound HTTP/HTTPS request at the edge, decides whether the source IP is abusive, and learns from abuse observed in any region.

What the system must do

  • Per-request decision: At the edge gateway, look up the client's IP reputation and return one of ALLOW, CHALLENGE (for example a CAPTCHA), or BLOCK.
  • Cross-region learning: Behavioral signals (repeated 401 responses, odd request patterns) seen in one region should lead to updated verdicts in all other regions within a few seconds.
  • Safe corrections: Operators must be able to apply manual overrides, allowlist by CIDR or ASN, and roll back a bad rule or list update everywhere within 10 seconds.
  • Audit trail: Every block decision and every administrative change must be recorded in a tamper-evident log that supports post-incident review.

Non-functional targets

  • Latency added by the check: at most 2 ms at p95 and 5 ms at p99.
  • Partition tolerance: If regions cannot talk to each other, each edge keeps enforcing from local state with no loss of service.
  • Collateral damage: Legitimate users who share an address through NAT or carrier-grade NAT must not be swept up in broad blocks.

Scale assumptions

  • 1,000,000 requests per second in total, across 6 regions.
  • 20 million malicious IPv4 addresses and 2 million malicious IPv6 /64 prefixes active at any time.
  • About 5,000 reputation changes per second worldwide (adds, updates, expirations).

What to cover in your answer

  1. Architecture: the path of a request, how the edge makes its decision, and how regional signals flow into global aggregation.
  2. Edge data structures: how millions of IPs and CIDR ranges are held in memory and queried in well under a millisecond.
  3. Cross-region replication: the topology and consistency model that propagates updates without synchronous cross-region waits.
  4. Rollback and safety: the emergency override path, plus protections such as staged rollouts and blast-radius limits.

Hints

Hint 1

Do the arithmetic first: 22 million entries at roughly 16 bytes each, and an update stream of only a few hundred KB/s. What does that imply about where lookups can happen and whether any network call belongs on the request path?

Hint 2

Not all state needs the same consistency. Reputation verdicts can merge conflict-free (precedence plus expiry), while overrides, rollbacks, and policy versions are rare and may justify consensus. Consider giving them separate channels.

Hint 3

Think about what could go wrong with your own system: a buggy detector blocking a whole ISP, or shared NAT addresses. How would you cap impact before publishing, ramp up gradually, and revert automatically?