← Lessons

quiz vs the machine

Gold1470

System Design

The CDN for API Acceleration

Speeding up dynamic API calls even when responses are not cacheable.

5 min read · core · beat Gold to climb

Beyond static files

CDNs are known for caching static assets, but they also accelerate dynamic APIs whose responses change per user. The win here is less about caching and more about the network path and connection handling.

Where the speedup comes from

  • Edge termination ends the user's TLS connection nearby, so the slow handshake happens over a short hop.
  • Warm origin connections are reused and kept open, skipping repeated setup to the origin.
  • Optimized backbone routes the request over the provider's private network instead of the public internet.

Caching what you can

Even dynamic APIs have cacheable parts. Short TTLs on read heavy endpoints, stale while revalidate, and caching responses for a few seconds can cut origin load on hot reads while keeping data fresh enough.

What stays at the origin

Writes and user specific reads still go to the origin, but they ride the faster path. The CDN becomes a smart front door that shortens handshakes, reuses connections, and caches the safe parts.

Key idea

A CDN accelerates dynamic APIs by terminating TLS near users, reusing warm origin connections over a private backbone, and caching the safe read paths.

Check yourself

Answer to earn rating on the learn ladder.

1. How does a CDN speed up a non cacheable API response?

2. Which technique helps cache parts of a dynamic API safely?