Performance Overhead

Learn about how enabling Session Replay impacts the performance of your Flutter app.

If you're considering enabling Session Replay, it's important to understand the potential performance impact to your app. Learn more about Replay SDK optimizations in the Replay Performance Overhead docs.

Meaningful metrics require realistic testing where you apply typical access patterns and correlate the results with your business metrics. To provide a baseline, we measure replay overhead using this Open Food Facts app. We chose Open Food Facts because it's an actively maintained open source app that presents several scrollable, interactable lists of both text and images during onboarding. The app also includes native functionality like a default camera view for barcode scanning, making for a more comprehensive testing scenario.

Here's how the benchmarks were conducted:

  • Configuration: Default (complete) masking was enabled, and optimized release builds were used.
  • User Flow: The same flow was executed 10 times to ensure consistency.
  • Real-World Representation: This approach closely mirrors performance in real-world scenarios. The benchmarks were run on a Pixel Fold (2023) running Android 15.

Below are the results of the benchmarking tests, presented as average values across all runs.

MetricSentry SDK onlySentry + Replay SDK
FPS42.6 fps42.6 fps
Total CPU Usage93.2%105.5% (+13%)
UI Thread CPU Usage30.7%30.7%
Memory372.5 MB391.6 MB (+5%)

To minimize the performance impact of the Replay SDK, consider the following steps:

Lowering the quality of captured screenshots and videos can significantly reduce CPU, memory, and network bandwidth usage. Here's how you can do it:

Copied
await SentryFlutter.init(
  (options) {
    ...
    options.replay.quality = SentryReplayQuality.low // defaults to medium
  },
  ...
);

If the Replay SDK causes performance issues on lower-end devices, you can disable it specifically for those devices (For example, by looking at how Sentry determines the device class, or using a Flutter plugin):

Copied
Future<bool> isLowEndDevice() {
  // You can use device_info_plus to retrieve the device info
  ...
}

await SentryFlutter.init(
  (options) {
    ...
    // Enable session replay for non low-end devices only
    final isLowEnd = await isLowEndDevice();
    options.replay.sessionSampleRate = isLowEnd ? 0 : 1.0;
    options.replay.onErrorSampleRate = isLowEnd ? 0 : 0.1;
  },
  ...
);
Was this helpful?
Help improve this content
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").