CDN Cost Optimization: Reducing Bills Without Sacrificing Performance

· Alex Petrov · 11 min read

CDN costs scale with traffic, and for high-traffic sites, the monthly bill can rival hosting costs. Yet most organizations pay 30–60% more than necessary because they have not optimized their cache configuration, compression settings, or pricing agreements. The good news: CDN cost optimization rarely requires sacrificing performance. In most cases, the changes that reduce costs also improve delivery speed. For a comprehensive overview, see our guide on CDN Monitoring and Observability: Metrics That Matter — FlyFish NWA.

This guide covers every lever you can pull to reduce CDN spending, from quick wins (enabling Brotli compression, fixing cache TTLs) to strategic decisions (committed-use contracts, multi-CDN arbitrage). Each section includes specific dollar-impact estimates so you can prioritize the optimizations that matter most for your traffic profile.

How Do CDN Pricing Models Work?

Before optimizing, you need to understand what you are paying for. CDN pricing has three primary components, and providers weight them differently.

CDN Network Overview — Understanding the delivery architectureCDN Network Overview — Understanding the delivery architecture CDN Network Topology — Content Delivery Flow U User A Tokyo U User B London U User C New York Edge Server Tokyo PoP Edge Server London PoP Edge Server New York PoP Mid-Tier Cache Origin Shield Origin Server Your Server Request Cache Miss Fetch Cache Hit → Instant Response
Figure 1: CDN Network Overview — Understanding the delivery architecture
ProviderBandwidth (per GB, first 10 TB)Requests (per 10K)Notable
Cloudflare$0 (unlimited)$0 (unlimited)All plans include unlimited bandwidth
AWS CloudFront$0.085$0.0100 (HTTPS)Free tier: 1 TB/month
Fastly$0.12$0.009Real-time log streaming included
AkamaiCustom (contract)CustomEnterprise-only, volume discounts
Bunny CDN$0.01IncludedFlat rate, no request fees
KeyCDN$0.04IncludedPay-as-you-go, no commitments

Bandwidth charges are the largest cost driver for most sites. You pay for every byte delivered from the CDN edge to the end user. Origin-to-CDN bandwidth (shield fills, cache misses) may incur separate charges depending on the provider.

Request charges matter for sites with many small files (API-heavy applications, sites with numerous tiny images). At CloudFront's HTTPS rate, 100 million requests per month costs $100—significant for high-request-volume, low-bandwidth applications.

Feature surcharges add up silently: edge functions ($0.50–1.00 per million invocations), image optimization ($0.01–0.03 per transformation), WAF requests ($0.60–1.00 per million inspected), and real-time log delivery ($0.01–0.05 per million log lines). Review your bill line by line.

How Does Improving Cache Hit Ratio Reduce Costs?

Cache hit ratio is the single most impactful cost lever. Every percentage point improvement reduces origin bandwidth, origin compute load, and (for some providers) request-tier pricing.

Performance Comparison: Edge vs Origin Processing
Metric Edge Processing Origin Processing Improvement
Latency (p50)8–15 ms120–300 ms15–20x faster
Cache Hit Ratio85–95%N/AReduces origin load
TLS Handshake1–5 ms (nearby PoP)50–150 ms10–30x faster
Bandwidth Cost$0.01–0.04/GB$0.05–0.12/GB3–5x cheaper
Availability99.99% (multi-PoP)99.9% (single DC)10x fewer outages

The math. Consider a site serving 100 TB/month through CloudFront. At a 70% cache hit ratio, 30 TB flows from origin. At a 90% cache hit ratio, only 10 TB flows from origin. That is a 67% reduction in origin egress (which you also pay for at your hosting provider). On the CDN side, cache hits are cheaper to serve (no origin fetch latency or connection overhead).

Quick wins for cache hit improvement:

Each of these is covered in depth in the Cache Hit Ratio Optimization guide. For the underlying cache key mechanics, see Cache Key Design.

How Much Can Compression Save on CDN Bandwidth?

Compression reduces the bytes transferred for text-based content (HTML, CSS, JS, JSON, SVG, XML). The savings are substantial and require minimal configuration.

Brotli vs gzip savings. Brotli at quality 11 compresses 15–25% better than gzip level 6 for typical web content. For a site serving 10 TB/month of compressible content via gzip, switching to Brotli saves 1.5–2.5 TB of bandwidth per month. At $0.08/GB, that is $120–200/month in direct savings. See Brotli and Gzip Compression for implementation details.

Pre-compression for static assets. Configure your build pipeline to generate .br (Brotli) and .gz (gzip) files alongside originals. The CDN serves the pre-compressed file directly without spending CPU on real-time compression. This allows Brotli quality 11 (maximum compression, too slow for real-time) for static assets.

Do not compress already-compressed formats. Images (JPEG, PNG, WebP), videos, fonts (WOFF2), and ZIP files are already compressed. Attempting to gzip them wastes CPU and may actually increase file size. Configure your CDN to skip compression for binary content types.

How Does Image Optimization Impact CDN Costs?

Images are the dominant bandwidth consumer for most websites, accounting for 50–70% of page weight. Image optimization at the CDN edge reduces bandwidth dramatically without requiring changes to your origin.

Request Lifecycle — How content moves through the CDNRequest Lifecycle — How content moves through the CDN CDN Request Flow — From Browser to Edge CDN Request Lifecycle Step 1 DNS Lookup Step 2 TCP Connect Step 3 TLS Handshake Step 4 Edge Server Step 5 Cache Check Step 6 Response Cache HIT → 5ms response Cache MISS → Fetch origin 0ms ~50ms (cache hit) ~200ms (cache miss)
Figure 2: Request Lifecycle — How content moves through the CDN

Format conversion. Automatic WebP/AVIF conversion reduces image bandwidth by 30–50%. For a site serving 50 TB/month of images, that is 15–25 TB of savings per month. Some CDN providers (Cloudflare, Fastly, imgix) include image optimization in their pricing; others charge per transformation.

Responsive resizing. Serving a 2000px wide image to a 375px mobile viewport wastes 80% of the bandwidth. CDN-based responsive resizing serves the correct dimensions for each device, reducing image bandwidth by an additional 30–50% for sites with significant mobile traffic.

Quality reduction. Dropping JPEG quality from 90 to 75 reduces file size by 30–40% with minimal visible difference. SSIM (Structural Similarity Index) analysis confirms that quality 70–80 is perceptually lossless for most photographs at web viewing sizes.

Combined impact example. A site serving 100 TB/month of images at $0.08/GB spends $8,000/month on image bandwidth alone. With format conversion (-35%), responsive resizing (-30% of remaining), and quality optimization (-25% of remaining): 100 TB becomes 34 TB, saving $5,280/month.

What Are Committed-Use Discounts and When Do They Make Sense?

Committed-use agreements (also called reserved capacity or annual contracts) trade volume commitments for per-unit price reductions. The discounts are substantial but carry risk.

Typical discount structures:

Commitment LevelTypical DiscountRisk
Monthly pay-as-you-go0% (list price)None
Annual commit ($5K/mo)15–25%Low (reasonable for stable traffic)
Annual commit ($25K/mo)25–40%Medium (traffic must justify spend)
Multi-year ($100K+/mo)40–60%High (locked in, use-it-or-lose-it)

When to commit. Sign a committed-use agreement when: your traffic is stable or growing (not seasonal with deep troughs), you have at least 6 months of historical traffic data to forecast accurately, and the committed spend is below 80% of your expected minimum monthly usage. The 80% rule protects against paying for unused capacity during slow months.

Negotiation tips. CDN sales teams have significant pricing flexibility. Start at 30% below their initial offer. Request bandwidth banking (unused capacity rolls over to future months). Ask for burst provisions (temporary overage at committed rates instead of on-demand rates). Get the contract reviewed by your legal team for auto-renewal traps and exit penalties.

How Does Multi-CDN Arbitrage Reduce Costs?

Multi-CDN strategies route different traffic types or regions to the most cost-effective provider. This is not just a cost play—it also improves reliability and performance—but the cost savings are a compelling reason to adopt it.

Content-based routing. Route bulk static content (images, videos, downloads) through the cheapest per-GB provider (Bunny CDN at $0.01/GB or Cloudflare at $0). Route dynamic content and APIs through the provider with the best origin connectivity (CloudFront if your origin is AWS, Azure CDN if Azure). Route security-sensitive traffic through the provider with the strongest WAF (Cloudflare or Akamai).

Geographic routing. CDN pricing varies dramatically by region. CloudFront charges $0.085/GB in North America but $0.170/GB in India and $0.120/GB in Asia Pacific. A regional CDN might offer better rates in specific markets. Use DNS-based or load-balancer-based routing to direct each region to the cheapest qualified provider.

Implementation. The traffic director (DNS-based like NS1 or Route 53, or a global load balancer) resolves to the appropriate CDN endpoint based on geography, content type (via separate hostnames: static.example.com, api.example.com), or real-time cost/performance data. Monitor the routing decisions using CDN log analysis to ensure cost optimization does not degrade performance.

How Do You Reduce Origin Egress Costs?

Origin egress—bandwidth from your origin server to the CDN—is often the hidden cost that CDN users overlook. Cloud providers charge $0.09–0.12/GB for outbound bandwidth, and every cache miss triggers an origin fetch.

Origin shield. An origin shield consolidates all cache fills through a single CDN PoP. Instead of 200 PoPs each independently fetching from origin, they fetch from the shield, which fetches once from origin. This can reduce origin egress by 90%+ for cacheable content. The shield adds 5–15 ms latency for cache misses but saves significantly on origin bandwidth costs.

Cache warming. Proactively populate the CDN cache by sending synthetic requests for your most popular content from each PoP. This prevents the burst of origin traffic that follows a cache purge or CDN configuration change. See Cache Warming Techniques for implementation approaches.

Conditional requests (If-Modified-Since/If-None-Match). When cached content expires, the CDN sends a conditional request to origin. If the content has not changed, origin responds with 304 Not Modified (a few hundred bytes) instead of the full resource. This reduces origin egress for revalidation by 95–99%.

What Free Tier Strategies Can You Use?

CDN free tiers are not just for hobbyists. Strategic use of free tiers can offset significant portions of your CDN bill, even for commercial sites.

Cloudflare Free. Unlimited bandwidth, SSL, basic WAF, and CDN caching. For sites where Cloudflare's feature set is sufficient, the free tier is genuinely production-ready. Limitations: no custom page rules (only 3 on free), limited WAF rules, and community-only support.

CloudFront free tier. 1 TB of data transfer and 10 million HTTP/HTTPS requests per month, perpetually free. Useful for development environments, staging sites, and low-traffic production sites.

Hybrid approach. Use Cloudflare Free for static content delivery and a paid provider (CloudFront, Fastly) for dynamic content and API acceleration. This leverages Cloudflare's unlimited bandwidth for the bulk of traffic while paying only for the dynamic content that needs a provider with specific features. This pairs well with API acceleration strategies.

How Do You Build a CDN Cost Dashboard?

Visibility drives optimization. Build a cost dashboard that tracks spending by category, identifies anomalies, and measures the impact of optimizations.

Key metrics to track:

Alerting thresholds. Set alerts for: daily spend exceeding 2x the 30-day average (traffic spike or DDoS), cache hit ratio dropping below 80% (configuration regression), and origin egress exceeding historical baseline by 50% (broken caching). These alerts catch cost problems within hours instead of at the monthly bill review.

Combine CDN cost data with the performance insights from Real User Monitoring to ensure that cost optimizations do not inadvertently degrade user experience. The goal is the lowest cost that meets your performance targets, not the lowest cost regardless of consequences.

External References

References & Standards: RFC 7234 · HTTP/2 specification