SentryAbdelrahman Awad5 min readintermediate
Measuring the back/forward cache with Application Metrics
Summary
The back/forward cache (bfcache) provides instant page navigation, but traditional performance tools cannot measure its effectiveness, creating a blind spot. Sentry's new `bfcacheMetricsIntegration` addresses this by exposing bfcache hits, misses, and reasons as application metrics, allowing engineers to track and optimize this critical user experience.
- bfcache enables instant back/forward navigation by freezing a page's state, significantly improving perceived speed.
- Existing performance tools typically miss bfcache hits, as success is silent, making it hard to track.
- Pages can be disqualified from bfcache by common factors like `unload` listeners, `Cache-Control: no-store`, or open connections.
- Sentry's integration provides `browser.bfcache.navigation` (hit/miss), `browser.bfcache.not_restored` (reasons), and `browser.bfcache.reload.duration` metrics.
Frontend engineers and performance specialists should care to measure and optimize a high-frequency user navigation path that significantly impacts perceived performance but is often overlooked by standard tooling.
6/10


