HTTP, caching & networking
Cache-Control, ETags, CDNs, HTTP/2 multiplexing, preload/prefetch, CORS. Most "slow page" investigations end in the Network tab.
The mental model
Every byte your page shows travelled over HTTP, and HTTP is a conversation with headers on both sides — the request says what it wants and what it will accept, the response says what it is and how long you may keep it. Frontend performance and correctness live almost entirely in those headers. The single most important idea: the fastest request is the one you never send, so caching is not an optimization you sprinkle on at the end — it is the primary mechanism by which the web is fast at all.
The analogy that sticks: a library with a returns desk. The first time you want a book you walk to the stacks (the **origin server**, maybe across an ocean). But there is a local branch (the **CDN**) that keeps popular books, and your own desk drawer (the **browser cache**) where you keep the ones you use daily. Cache-Control is the sticky note on each book saying "keep this for 30 days" (fresh — reuse it, no trip) or "check with the desk before trusting it" (stale — but maybe still good). ETag is a version stamp: instead of re-borrowing a heavy book, you ask "is my copy still current?" and the desk answers "yes, keep it" (a tiny 304) without handing you the whole book again. A CDN is that branch library placed near every reader on Earth.
What breaks without this model is both directions of pain. Under-cache and every page load re-downloads megabytes it already had, LCP suffers, and your origin melts under traffic it should never see. Over-cache the wrong thing and users see a stale price, an old JavaScript bundle that no longer matches the API, or a deployed fix that never reaches anyone because the HTML was cached for a year. A "why is my deploy not showing" incident is a caching incident. A "why is the API returning yesterday's data" incident is a caching incident. A "why is my page slow only for users in Australia" incident is a CDN-geography incident. Once you can read the response headers and the Network tab, each of these stops being mysterious and becomes a line you can point at.
- Deep dive
- Internal architecture
- Real-world use cases
- Best practices
- Common mistakes
- Performance
- Security
- Production troubleshooting
- Advantages & disadvantages
- Alternatives
- Interview expectations
- Interview questions
- Facts to remember
- Cheat sheet
- Quick revision