Member-only story
Application-Level vs CDN-Level Caching: What You Should Cache Where
When we first started scaling traffic on one of our web applications, we noticed something strange. Our backend services were robust, the database was optimized, but user requests were still sluggish. We traced the issue down to one thing: our caching strategy — or rather, the lack of a coherent one.
This article dives into the differences between Application-level and CDN-level caching, what each is good at, and how you should decide what to cache where.
The Basics: What Is Caching?
Caching stores a copy of data that’s expensive to compute or fetch, so that future requests can be served faster.
There are two broad categories we’ll focus on:
- Application-Level Caching: Happens within your backend services.
- CDN-Level Caching: Happens at the edge, often close to your users.
Let’s understand the strengths of each.
CDN-Level Caching
Best For:
- Static assets: images, fonts, JS/CSS files
- Public, cacheable API responses: e.g., product listings, blog articles
- Geo-distributed traffic: when user base is globally distributed