Distributed System Design - Caching
Pre-compute
The key to speed is to precompute everything and cache it.
For example, Reddit precomputes all 15 different sort orders (hot, new, top, old, this week. etc) for listings when someone submits a link. Every listing has 15 different sort orders (hot, new, top, old, this week). When someone submits a link they recalculate all the possible listing that link could effect. http://highscalability.com/blog/2010/5/17/7-lessons-learned-while-building-reddit-to-270-million-page.html
- use Cache to store the most frequently used data
- Pre-generate static HTML files
- Minify and compress
- use CDN to serve pre-computed pages and results
CliqueMap vs memcached
- CliqueMap: for hyperscale workloads (100M+ reads/s)
- Memcached/Redis: on the order of 100K - 1M reads/s
CliqueMap paper: https://research.google/pubs/cliquemap-productionizing-an-rma-based-distributed-caching-system/