Caching and CDN
In this lesson we learn about a cache (a fast place that stores answers we already computed, so we don't redo the work; like a sticky note on your desk with an answer you already found). We meet a few working styles: cache-aside (read from the cache, and if it is empty go to the source and save it f
System Design (planning how to build big software that serves many people) is like planning a city: roads, storage, traffic lights, and maintenance crews, so the city keeps working well even during the busiest rush hour.
- Caching
- Storing ready-made answers in a fast place (a cache) so you respond quickly and avoid doing the same work twice. The core skill of this lesson covers cache-aside (read from the cache, and if empty go to the source and save it), write-through (save to both cache and source together), TTL (how long an answer stays "fresh"), invalidation (discarding stale data), hot keys (items everyone requests at once), and a CDN (servers spread around the world that keep copies close to the user).
- Trade-off
- A conscious choice that has both a gain and a cost — just like picking a route: the fast road costs a toll, the free one takes longer. In an interview you explain to the interviewer the gain and the cost of each choice.
- Operational metric
- A number that shows whether the decision really works once the system is live and serving real users (production). For example: latency (how long a response takes), error rate (the share of requests that fail), queue lag (how many tasks are waiting in line), and cache hit ratio (how often we found a ready-made answer). Like the gauges on a car dashboard — they tell you if everything is fine.