How should you serve static assets (images, JS, downloads), and why not from your application servers?
What they are really testing: Whether you know to serve static content from object storage behind a CDN, offloading the app servers, and the reasons (scale, cost, latency) rather than streaming bytes through your app.
A real interview question
How should you serve static assets (images, JS, downloads), and why not from your application servers?
What most people say
drag me
“I would serve the files from my web server like any other request.”
Serving static bytes from app servers wastes their resources, scales poorly, and is slow and expensive at distance. The standard pattern is object storage behind a CDN, which offloads the origin and serves from the edge.
The follow-ups they ask next
Why is serving static files from app servers a scaling problem?
It consumes the app servers CPU/memory/connections holding open downloads, competing with dynamic requests, and a traffic spike hits your origin directly. Offloading to a CDN lets the app scale on logic, not byte-serving.
How do you update a cached asset without serving stale content?
Content-hashed filenames (cache busting): a changed file gets a new name/URL, so clients fetch the new one immediately while you still cache aggressively with long TTLs. Or issue a CDN invalidation, but hashing is cleaner.
What the interviewer is listening for
- Object storage + CDN, not app servers
- Knows the scale/cost/latency reasons
- Cache headers + content-hash cache busting
What sinks the answer
- Serves static from app servers
- No CDN
- No cache/invalidation strategy
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“Serve static assets from [object storage behind a CDN, cached at the edge near users], not [from app servers, which waste resources/connections and scale poorly]. The CDN is [cheaper per GB, faster, offloads origin traffic/egress, scales infinitely; origin serves only cache misses]. Manage with [cache headers/TTLs and content-hashed filenames for cache busting]. App servers stay [for dynamic work].”
Keep going with storage
Foundation
What is the difference between durability and availability for storage?
Foundation
What is the difference between backup and replication, and why is replication not a backup?
Junior
Explain the difference between object, block, and file storage, and give one good use case for each.
Junior
How does object storage achieve such high durability?
Junior
What consistency guarantees does object storage give, and why does it matter?
Junior
For block storage, what is the difference between IOPS and throughput, and how does it affect volume choice?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free