Caching
Definition
Storing frequently accessed data in a fast-access location to improve performance, reduce latency, and enhance user experience in applications.
Use Cases
- Netflix: Speeding up access to frequently used application data (for example, user/session-related and metadata lookups) to reduce latency and backend load. — Uses distributed caching patterns in its microservices architecture, commonly leveraging in-memory key-value stores (such as Redis-based caching) to serve hot data and reduce repeated calls to slower data stores. (Lower request latency and reduced load on backend databases/services, improving responsiveness during high traffic.)
- Shopify: Improving storefront performance by caching frequently requested content and computed results (for example, rendered pages/fragments and expensive queries). — Uses caching at multiple layers (application-level caching and edge/CDN caching) so repeat requests can be served without recomputing or re-querying the database each time. (Faster page loads for shoppers and better ability to handle traffic spikes with fewer backend resources.)
- Wikipedia: Serving popular pages quickly and reducing database load for a read-heavy website. — Uses layered caching (edge caching and application/object caching) so frequently accessed pages and objects are served from cache instead of hitting origin servers and databases on every request. (Improved site responsiveness and significantly reduced origin/database traffic for high-demand content.)
Provider Equivalents
- AWS: Amazon ElastiCache
- Azure: Azure Cache for Redis
- GCP: Memorystore
- OCI: OCI Cache with Redis
Frequently Asked Questions
- What's the difference between caching and a CDN?
- Caching is the general technique of storing frequently used data closer to where it’s needed (often in memory or on local disk). A CDN is a global network that caches and delivers content (especially static files like images, CSS, and videos) from edge locations near users. In practice, a CDN is one specific way to do caching for web content.
- When should I use caching?
- Use caching when you have data that is read frequently, changes relatively infrequently, or is expensive/slow to compute or fetch (like database queries, API responses, session data, or rendered pages). It’s especially helpful when you need lower latency, want to reduce database load, or must handle traffic spikes. Avoid caching when data must always be perfectly up-to-date or when you can’t tolerate serving slightly stale results without careful invalidation.
- How much does caching cost?
- Costs depend on the caching layer you choose and how much data/traffic you cache. Managed in-memory caches (like Redis services) are typically priced by node size, number of nodes, and sometimes network transfer. CDN caching is usually priced by data transfer and request volume. Additional cost factors include high availability (replicas), multi-zone deployments, reserved capacity/commitments, and operational overhead (monitoring, tuning TTLs, and cache invalidation).
Category: networking
Difficulty: basic
Related Terms
See Also