CDN Edge Computing & Edge Functions 5 — Questions and Answers
Question 1: What is the role of the Cache-Tag (or surrogate key) header in edge computing deployments?
- It encrypts cached objects for multi-tenant safety
- It associates cached responses with logical tags so they can be purged in bulk with a single API call (Correct answer)
- It signals the edge to revalidate the cache every 60 seconds
- It identifies which edge node originally cached the object
Correct answer: It associates cached responses with logical tags so they can be purged in bulk with a single API call
Cache-Tag / surrogate key headers let operators invalidate groups of related cached objects atomically without knowing exact URLs.
Question 2: Which of the following correctly describes the execution environment difference between Cloudflare Workers and AWS Lambda@Edge?
- Workers run in V8 Isolates with sub-millisecond cold starts; Lambda@Edge runs in full Node.js containers with higher cold-start latency (Correct answer)
- Workers are limited to static responses; Lambda@Edge can make dynamic decisions
- Lambda@Edge runs closer to users than Workers
- Workers require a VPC configuration while Lambda@Edge does not
Correct answer: Workers run in V8 Isolates with sub-millisecond cold starts; Lambda@Edge runs in full Node.js containers with higher cold-start latency
Cloudflare Workers use lightweight V8 Isolates for near-zero cold starts, while Lambda@Edge runs in managed containers with higher initialization overhead.
Question 3: What does 'fan-out' mean in the context of edge function subrequests?
- Distributing a single edge function across multiple PoPs simultaneously
- An edge function making multiple parallel upstream requests to assemble a composite response (Correct answer)
- Splitting a large cached object into chunks for parallel delivery
- Broadcasting a cache purge event to all edge nodes at once
Correct answer: An edge function making multiple parallel upstream requests to assemble a composite response
Fan-out allows an edge function to fetch data from several microservices or APIs concurrently, then merge the results into one response for the client.
Question 4: A streaming edge function uses the TransformStream API. What is the main benefit over a buffered response approach?
- It allows the edge to skip TLS handshake overhead
- It reduces Time To First Byte by piping response chunks to the client as they arrive rather than waiting for the full response (Correct answer)
- It automatically compresses the response with Brotli
- It enables the edge function to rewrite content after the client has received it
Correct answer: It reduces Time To First Byte by piping response chunks to the client as they arrive rather than waiting for the full response
Streaming responses let the edge begin forwarding data to the client immediately, improving perceived performance for large or slow-generating payloads.
Question 5: What is 'stale-while-revalidate' (SWR) and what problem does it solve at the edge?
- A TLS certificate rotation mechanism that avoids downtime
- A caching directive that serves a stale cached response immediately while refreshing the cache in the background, eliminating latency spikes on cache expiry (Correct answer)
- A fallback that serves the origin response when the edge cache is full
- A header that forces the browser to revalidate every request
Correct answer: A caching directive that serves a stale cached response immediately while refreshing the cache in the background, eliminating latency spikes on cache expiry
SWR decouples cache freshness from user-facing latency so users always get a fast cached hit while the edge silently updates the entry for the next request.
Question 6: Which edge function event hook allows you to modify an HTTP response before it is delivered to the client, including adding security headers?
- fetch event on the request lifecycle before the upstream call
- The response transform phase within event.respondWith() after fetching from origin (Correct answer)
- Origin connect event
- TLS handshake event
Correct answer: The response transform phase within event.respondWith() after fetching from origin
Platforms expose a response-phase hook (within event.respondWith()) where developers can mutate the Response object to inject security headers like CSP or HSTS.
Question 7: Why is the edge function bundle size important, and what is a common size limit imposed by CDN platforms?
- Larger bundles cause DNS resolution to fail
- Bundle size affects cold-start time and memory usage; platforms often cap bundles at 1 to 10 MB (e.g., Cloudflare Workers at 10 MB compressed) (Correct answer)
- Bundle size determines how many PoPs will host the function
- Larger bundles automatically trigger Brotli compression at deployment
Correct answer: Bundle size affects cold-start time and memory usage; platforms often cap bundles at 1 to 10 MB (e.g., Cloudflare Workers at 10 MB compressed)
Oversized bundles increase isolate initialization time and memory footprint, so platforms impose strict size caps to maintain the low-latency guarantees of edge execution.
What is the role of the Cache-Tag (or surrogate key) header in edge computing deployments?