Bird
Raised Fist0

CDN Architecture - Edge Nodes, Points of Presence, Origin Pull vs Push

HLDmediumInterview freq: high
Choose your preparation mode4 modes available
▶
Request Trace
Step 1/8
DNS Resolver

Resolves user domain to IP of nearest Edge Node

Receives DNS query and returns IP address of closest Edge Node

Protocol:UDP DNS Query
BeforeUser's browser has domain name but no IP address
AfterBrowser has IP address of Edge Node for request
Global Load Balancer

Routes HTTP request to optimal Edge Node

Receives HTTP request and forwards to Edge Node based on proximity and load

Protocol:HTTP
BeforeRequest arrived at load balancer with Edge Node IP
AfterRequest forwarded to selected Edge Node
Edge Nodes

Checks cache for requested content

Cache miss triggers HTTP pull from PoPs

Protocol:HTTP
BeforeEdge Node cache does not contain requested asset
AfterEdge Node issues HTTP request to PoPs for content
PoPs (Points of Presence)

Forwards request to Origin Servers on cache miss

PoPs check local cache, miss causes request to origin

Protocol:HTTP
BeforePoPs have no cached copy of requested content
AfterPoPs forward HTTP request to Origin Servers
Origin Servers

Serves original content to PoPs

Origin responds with requested asset

Protocol:HTTP
BeforeOrigin has original content ready to serve
AfterContent sent back to PoPs
PoPs (Points of Presence)

Caches content and forwards to Edge Nodes

Stores content for future requests and sends to Edge Node

Protocol:HTTP
BeforePoPs received content from Origin
AfterPoPs cache content and forward to Edge Node
Edge Nodes

Caches content and serves user request

Stores content locally and responds to user

Protocol:HTTP
BeforeEdge Node waiting for content from PoPs
AfterEdge Node caches content and serves user
Cache Invalidation Service

Pushes invalidation messages to Edge Nodes

Sends cache invalidation to update stale content

Protocol:Push Notification
BeforeContent updated at Origin but stale in caches
AfterEdge Nodes receive invalidation and purge stale cache
🏗️
Architecture Diagram
Architecture Diagram
┌───────────────────┐
│    DNS Resolver   │
└─────────┬─────────┘
          │ DNS Query (UDP)
          ▼
┌───────────────────────────┐
│  Global Load Balancer      │
└─────────────┬─────────────┘
              │ HTTP Request
              ▼
┌───────────────────┐
│    Edge Nodes     │
│ (Cache Layer)     │
└───────┬───────────┘
        │ Cache MISS: HTTP Pull
        ▼
┌───────────────────────────┐
│ PoPs (Points of Presence) │
│ (Regional Aggregation)    │
└───────┬───────────┘
        │ HTTP Request
        ▼
┌───────────────────┐
│  Origin Servers   │
│ (Content Source)  │
└───────┬───────────┘
        │ HTTP Response
        ▲
        │
┌───────┴───────────┐
│ Cache Invalidation │
│     Service       │
└────────┬──────────┘
         │ Invalidation Msg (Push)
         ▼
┌───────────────────┐
│ Monitoring &      │
│ Metrics Service   │
└───────────────────┘

This CDN architecture routes user requests through DNS resolution to the nearest Edge Node, which acts as a cache layer. On a cache miss, the Edge Node pulls content from regional Points of Presence (PoPs), which themselves pull from Origin Servers if needed. The Cache Invalidation Service pushes updates to Edge Nodes to maintain freshness. Monitoring & Metrics Service collects telemetry across components. This design balances low latency via Edge caching with consistency via origin pulls and invalidation pushes, optimizing content delivery globally.

Primary Focus

✓

Practice

(1/5)
1. In a system designed for 99.999% availability, at step 4 the Delivery Worker checks the message queue for pending retries. What happens if the message is not acknowledged by the consumer within the visibility timeout?
easy
A. The message is archived permanently without retry
B. The message is deleted immediately to prevent duplicates
C. The message becomes visible again for redelivery to another consumer
D. The Delivery Worker blocks until the consumer acknowledges

Solution

  1. Step 1: Trace Delivery Worker decision at Step 4 -- message visibility timeout

    If the message is not acknowledged within the visibility timeout, it becomes visible again for redelivery to ensure no message loss.
  2. Step 2: Eliminate incorrect options

    Immediate deletion (A) risks message loss; archiving without retry (C) breaks availability; blocking (D) reduces throughput and availability.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Visibility timeout expiry -> message re-queued for retry [check]
Hint: Visibility timeout expiry -> message re-queued for retry [check]
Common Mistakes:
2. For a proximity service requiring low-latency queries and frequent updates of business locations, which spatial indexing approach is better and why?
medium
A. Use Geohash-based indexing because it supports efficient prefix queries and simpler updates
B. Use a full R-tree index because it guarantees minimal overlap and tight bounding rectangles
C. Use a grid-based fixed cell index because it provides exact bounding box queries without hierarchy
D. Use a Quadtree because it supports fast insertions and deletions with balanced trees

Solution

  1. Step 1: Compare update and query costs

    Quadtree (Use a Quadtree because it supports fast insertions and deletions with balanced trees) can become unbalanced and expensive to update frequently. R-tree (Use a full R-tree index because it guarantees minimal overlap and tight bounding rectangles) is complex and costly to maintain with frequent writes.
  2. Step 2: Evaluate Geohash benefits

    Geohash (Use Geohash-based indexing because it supports efficient prefix queries and simpler updates) encodes locations into fixed-length strings allowing efficient prefix queries and simpler incremental updates, ideal for low-latency and frequent writes.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Geohash supports efficient prefix queries and simpler updates [check]
Hint: Geohash enables fast prefix queries and simpler frequent updates [OK]
Common Mistakes:
3. For a mobile app with limited bandwidth and unpredictable network latency, which API design is better to minimize data usage and why?
medium
A. Use REST with multiple endpoints to fetch only needed data per screen
B. Use REST with a single endpoint returning all data to avoid multiple round-trips
C. Use GraphQL subscriptions to push all data updates continuously
D. Use GraphQL to request exactly the fields needed in one query, reducing over-fetching

Solution

  1. Step 1: Analyze bandwidth and latency constraints

    Mobile apps benefit from minimizing data transfer and round-trips due to limited bandwidth and latency.
  2. Step 2: Compare REST and GraphQL trade-offs

    REST multiple endpoints cause multiple round-trips; single endpoint REST over-fetches; GraphQL queries exactly needed fields in one request.
  3. Final Answer:

    Option D -> Option D
  4. Quick Check:

    GraphQL reduces over-fetching and round-trips for mobile [check]
Hint: GraphQL single query cuts data and round-trips [check]
Common Mistakes:
4. For a distributed API gateway enforcing rate limits per user, which design is best to handle burst traffic while maintaining consistency?
medium
A. Use local token buckets per gateway with periodic token sync and eventual consistency
B. Use a centralized Redis token bucket shared by all gateways with strong consistency
C. Use a fixed window counter stored in a distributed cache updated synchronously
D. Use a leaky bucket implemented in each gateway without synchronization

Solution

  1. Step 1: Evaluate centralized Redis token bucket

    Strong consistency causes high latency and bottlenecks under burst traffic.
  2. Step 2: Evaluate local token buckets with periodic sync

    Allows burst handling locally with eventual consistency, reducing latency and bottlenecks.
  3. Step 3: Eliminate fixed window and leaky bucket options

    Fixed window counters cause burst spikes; leaky bucket disallows bursts and lacks sync.
  4. Final Answer:

    Option A -> Option A
  5. Quick Check:

    Local token buckets + eventual sync balance burst and consistency [check]
Hint: Local buckets + sync handle bursts and scale better [OK]
Common Mistakes:
5. At 10x scale, which component in the alerting system is most likely to become the bottleneck first, and why?
hard
A. Anomaly detection engine, because complex ML models require exponential compute as data volume grows
B. Event ingestion pipeline, due to limited write throughput and storage I/O constraints
C. Composite alert processor, because combining many alerts requires stateful joins that grow quadratically
D. Threshold alerting component, since static limit checks are CPU-light and easily parallelizable

Solution

  1. Step 1: Identify scale bottlenecks

    At 10x scale, write throughput and storage I/O become critical constraints for ingestion pipelines.
  2. Step 2: Compare component scalability

    Anomaly detection can be scaled horizontally; composite alerting state grows but less than ingestion I/O; threshold checks are lightweight.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    Ingestion pipeline limited by write throughput and storage I/O [check]
Hint: 10x scale -> ingestion pipeline hits write I/O bottleneck first [check]
Common Mistakes:
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