The bfcache Trade-off: Instant Restores vs Silent Misses
bfcache freezes page snapshots for instant back/forward navigation, but unload listeners, cache headers, or third-party scripts can silently disable it. This explainer maps the trade-offs and the metrics that reveal them.
The back/forward cache (bfcache) freezes a page snapshot so back and forward navigation feels instant. Its benefit is a large perceived performance win, but the cost is fragility: unload listeners, cache-control headers, or third-party scripts can silently prevent it from being used. The condition for managing this trade-off is measurement. Sentry's bfcacheMetricsIntegration models hit/miss outcomes, miss reasons, and fallback reload duration as application metrics. Engineers can break down bfcache health by route, release, or browser and catch regressions. The decision is whether to invest in bfcache optimization and monitoring; an unobserved performance feature is one you cannot trust.
FAQ
What can silently disable bfcache?
Unload listeners, cache-control headers, and third-party scripts can prevent bfcache from being used. The notRestoredReasons API in Chromium reports why a page was not restored, but detailed reasons are currently Chromium-only.
How do I measure bfcache health?
Sentry's bfcacheMetricsIntegration models a navigation hit/miss counter, a per-reason miss counter, and a fallback reload duration distribution as application metrics. You can query them by route, release, or browser to find regressions.
When is bfcache optimization worth the trade-off?
It is worth it when users frequently navigate back and forward and you can monitor miss reasons. The benefit is instant restores; the cost is fragility and measurement overhead, so the condition is having telemetry in place before optimizing.
Atlas Search finds matching document IDs fast, but materializing each hit from the collection is where the latency and CPU go. This trade-off map shows the benefit, the cost, and the condition for accepting that second phase.
Ad ranking is a compute trade-off: more resources per request can improve relevance, but GPU capacity and latency are finite. Learn how to allocate by marginal utility instead of uniformly.
CIBA moves authentication off the device in use: the client sends a back-channel request and the user approves on an enrolled phone. See what that buys and what it costs.
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.