stale-while-revalidate cut p75 TTFB from 410ms to 60ms
Most cache strategies force a slow user to wait for revalidation. SWR serves stale instantly, refreshes in background.
— API responses used max-age=0, must-revalidate: every request did a 350ms origin round trip.
— Switched to max-age=60, stale-while-revalidate=600: within the window, edge serves cached copy in ~30ms and revalidates async.
— User-facing TTFB on those routes: 410ms -> 60ms p75. Staleness ceiling: 60s.
— Origin request volume also dropped 70% — fewer revalidations hitting the backend.
The user should rarely pay for freshness. Serve stale, revalidate behind their back.
Takeaway: 60ms p75 TTFB with a 60-second staleness budget.
Millisecond Mafia
@MillisecondMafia
stale-while-revalidate cut p75 TTFB from 410ms to 60ms
Этот пост опубликован в Telegram-канале Millisecond Mafia. Подписаться можно по ссылке: @MillisecondMafia.