Full-Stack Engineer · 2022 · 5 months
Scaling a Wikipedia-style reader to 10M+ monthly visitors
A distraction-free encyclopedia serving readers worldwide needed sub-100ms responses under heavy, spiky traffic. Pairing Redis caching with Next.js SSR kept API latency under 100ms while scaling past 10 million monthly visitors.
Context
The product reimagined Wikipedia as a clean, ad-free reading experience backed by the public Wikipedia REST API. Content was effectively unbounded and read-heavy, and traffic spiked unpredictably around trending topics.
Constraints
- Upstream rate limits on the Wikipedia API made naive per-request fetching a non-starter at scale.
- Read-heavy, spiky traffic demanded consistent latency, not just good averages.
- Small infrastructure budget — the answer had to be caching discipline, not horizontal brute force.
Approach
- Redis as the read layer. Article and search responses were cached with TTLs tuned per content volatility, collapsing repeated upstream calls into single fetches.
- Next.js SSR + incremental revalidation served fully rendered pages fast and kept popular articles warm.
- Request coalescing ensured a cache miss on a hot article triggered exactly one upstream fetch, not a thundering herd.
Architecture
Readers hit Next.js SSR, which reads from Redis; only cache misses fall through to the Wikipedia API, and every miss repopulates the cache for the next reader.
Results
- API responses stayed under 100ms at the cache layer.
- Scaled past 10M monthly visitors without proportional infrastructure growth.
- Upstream API load dropped sharply thanks to coalescing and TTL tuning.
What I'd do differently
I'd add a stale-while-revalidate tier from the start so that even cache-expiry moments served instantly while refreshing in the background.