⚡ ~/naveed Interview Prep
⚡ Portfolio Home ✍️ Engineering Blog Deep Dives 🎯 Interview Hub 1,000+ Scenarios ☸️ Kubernetes Mastery Hub 24 Modules 🎮 DevOps Arcade & Quizzes Subnet Blitz ⚡ 🗺️ DevOps Roadmaps PDFs & Guides 🤖 Morpheus Analysis AI Quant ↗ 🛠️ Developer Tools Utilities 🧪 Labs & Experiments 📄 Interactive CV & Certs 🔗 All Links & Socials ⚡ Join The Dispatch (Weekly SRE Newsletter) →
← Back to All FinOps & System Design Interview Questions Scenario 71 of 98 in FinOps & System Design
Staff SRE / Edge Infrastructure Architect System Design Content Delivery & Edge Computing System Design

Q: Your global e-commerce platform suffers from 1,200ms page load times for international customers because dynamic HTML pages require querying origin servers across oceans. 80% of page content is identical, but 20% contains personalized user data (cart count, username). How do you architect an edge delivery network combining edge compute and dynamic caching to achieve sub-20ms global page delivery?

Engineering a high-performance Content Delivery Network (CDN) tier utilizing edge compute workers (Cloudflare Workers / Fastly VCL) for dynamic personalization, stale-while-revalidate caching, and sub-15ms global response times.

#System Design #CDN #Edge Compute #Cloudflare Workers #Varnish #Caching
🎙️ Candidate Opening & Architectural Context
"Standard CDNs only cache static assets (images, CSS, JS), forcing all dynamic HTML requests to traverse transatlantic cables to the origin. We architected a low-latency edge delivery platform utilizing Edge Workers (V8 isolates), Edge Side Includes (ESI), and Stale-While-Revalidate caching."
Advertisement
⚡ Recommended Practice Lab

Want to master this scenario in a live sandbox? The Linux Foundation's FinOps Certified Practitioner (FOCP) Program covers this exact problem with hands-on terminal drills.

🛠️ Production Runbook & Step-by-Step Resolution

1️⃣

Assemble Dynamic HTML at the Edge via Edge Workers (Edge Side Includes)

Decouple static page layout caching from personalized user state:

  • V8 Isolate Workers: Deployed Edge Compute Workers (Cloudflare Workers / Fastly Compute) executing at 300+ edge Points of Presence.
  • Edge Fragment Stitching: The worker caches the static HTML shell at the edge (95% of HTML bytes).
  • Personalization Injection: The worker inspects the client's JWT session cookie, fetches personalized fragments (cart items, user name) from an edge Key-Value store (sub-2ms), and stitches the final HTML in memory before returning HTTP 200.
Pro Tip: Stitching HTML dynamically at the edge delivers fully personalized pages without ever contacting origin datacenters.
2️⃣

Implement Stale-While-Revalidate & Stale-If-Error Caching Policies

Shield origin servers from traffic spikes while serving instant responses:

  • Cache Headers: Enforced Cache-Control: public, max-age=60, stale-while-revalidate=86400, stale-if-error=604800.
  • Zero Client Latency: When cache expires, edge immediately serves the cached stale asset to the user in 8ms, while asynchronously firing a background request to origin to revalidate the cache.
  • Origin Outage Immunity: If the origin server crashes (HTTP 500 / timeout), edge serves the cached stale version for up to 7 days, rendering origin outages invisible to users.
Pro Tip: Stale-while-revalidate eliminates cache-miss latency spikes for end users while smoothing out origin traffic surges.
3️⃣

Configure Tiered Caching & Origin Shield Architecture

Prevent thundering herd cache-fill storms from crashing origin servers:

  • Tiered Cache Architecture: Global edge PoPs query regional Tier-2 Parent Cache Shields before contacting the origin.
  • Origin Traffic Reduction: Instead of 300 edge PoPs each requesting a cache refresh from origin, only 3 regional parent shields contact origin, slashing origin cache-fill bandwidth by 98%.
Pro Tip: Origin Shielding concentrates cache misses into centralized regional hubs, protecting origin databases from being crushed during viral traffic spikes.
4️⃣

Deploy Sub-100ms Global Cache Invalidation via Surrogate Keys

Guarantee instantaneous data freshness when catalog items are updated:

  • Surrogate-Keys / Cache-Tags: Attached headers Cache-Tag: product-1234, category-electronics to responses.
  • Instant Invalidation: When product inventory changes, CMS publishes an event to an edge purge API, instantly invalidating all related cached assets across all 300 global PoPs within 80 milliseconds.
Pro Tip: Tag-based cache invalidation allows caching dynamic content aggressively for days, confident that updates will purge instantly.
💡 The Senior SRE Gold Nugget (Key Architectural Takeaway)
"Transforming dynamic page load latency requires edge compute workers for HTML personalization, stale-while-revalidate caching to eliminate cache-miss pauses, and origin shielding to protect backends."
⚡ 60-Second Elevator Pitch Talking Points
  • Assemble personalized dynamic HTML in edge V8 workers by stitching cached shells with user KV data.
  • Enforce stale-while-revalidate cache headers to deliver instant 8ms responses and mask origin outages.
  • Deploy Tiered Caching and Origin Shields to reduce backend cache-miss traffic by 98%.
  • Use surrogate cache tags to invalidate content globally across 300+ PoPs in under 100 milliseconds.
Advertisement
Want more FinOps & System Design scenarios?
Explore our complete collection of scenario-based FinOps & System Design interview runbooks.
Browse All FinOps & System Design Questions →