Skip to content
/
Suscribirse Subscribe

Detrás del telón hay sistemas, no magia. Arquitectura de software, IA y computación de bajo nivel para las trincheras de producción.

Behind the curtain there are systems, not magic. Software architecture, AI, and systems engineering from the production trenches.

SYSADMIN & DEVOPS UTILITY #TOOL-CAT-UTILS

CDN Cache-Control, S-MaxAge & Stale-While-Revalidate Egress Calculator

Simulate exact Edge Hit Ratio (%), origin request offload, monthly egress bandwidth savings (GB/TB), and TTFB latency improvements across Cloudflare, AWS CloudFront, Fastly, and GCP. Configure s-maxage, stale-while-revalidate, and immutable directives to slash cloud bills and prevent origin stampedes.

Architecture Presets:
Total incoming HTTP requests per month (traffic volume)
Payload size per HTTP response transfer
Controls edge persistence and revalidation model
Data transfer out price to the public Internet
Time the reverse proxy / CDN caches response before revalidating
Window to serve stale cache while fetching fresh copy in background
Monthly Architecture & Egress Efficiency Impact
Edge Cache Hit Ratio
-- %
--
Egress Bandwidth Offloaded
-- GB
--
Monthly Cloud Bill Reduction
-- €
--
Perceived TTFB Latency
-- ms
--
Generated Production HTTP Header
Cache-Control: public, max-age=3600, s-maxage=86400, stale-while-revalidate=600

Technical Breakdown: Direct Origin vs CDN Edge Caching

Infrastructure Metric Without CDN Cache With Cache-Control Net Optimization
Origin Server Requests -- -- --
Egress Data Transferred -- -- --
Monthly Egress Cloud Cost -- -- --
P95 TTFB Response Latency 380 ms (P95) -- --

Engineering Architecture FAQ

What is the difference between max-age and s-maxage?

max-age specifies the maximum time (in seconds) that a client browser is allowed to cache a resource. s-maxage (shared max-age) overrides max-age exclusively for public shared caches (like Cloudflare, CloudFront, or Fastly). This allows you to cache a page on the CDN for 24 hours (s-maxage=86400) while telling client browsers to revalidate every hour (max-age=3600).

How does stale-while-revalidate prevent the 'Thundering Herd' problem?

When a cached resource expires under high traffic, hundreds of concurrent users would normally miss the cache simultaneously, hitting the origin database all at once (cache stampede). stale-while-revalidate instructs the CDN to immediately serve the expired (stale) copy in milliseconds while launching a single asynchronous background request to refresh the origin.

Why do AWS and GCP charge so much for egress compared to Cloudflare?

Major hyperscalers (AWS, Azure, GCP) treat outbound internet data transfer as a high-margin revenue stream, charging between $0.08 and $0.09 per GB. Cloudflare, as co-founder of the Bandwidth Alliance, peers directly with transit networks and waives egress fees between member clouds, reducing data transfer costs to virtually zero.

Model based on RFC 9111 (HTTP Caching Standards) and RFC 5861 (Stale-While-Revalidate). Calculations assume Pareto/Zipf traffic distribution across edge Points of Presence (POPs). Real-world performance depends on cache-purging frequency and cookie/header variance.
Suscribirse Subscribe