Skip to content

Latest commit

 

History

History
75 lines (54 loc) · 3.99 KB

File metadata and controls

75 lines (54 loc) · 3.99 KB
title Performance Overhead
sidebar_order 5502
notSupported
description Learn about how enabling Session Replay impacts the performance of your application.

If you're considering enabling Session Replay, it's important to first understand the potential performance impact to your app. While accurate metrics require realistic testing where you apply typical access patterns and correlate the results with your business metrics, to provide a baseline, we measured the overhead using the open-source Pocket Casts app.

You can learn more about the various optimizations implemented in the React Native Replay SDK in the Replay Performance Overhead docs.

The React Native Replay SDK is a lightweight wrapper for the native iOS and Android SDKs, so its overhead is minimal and doesn't require separate measurement. Below are the benchmark results for each platform.

We measured the overhead using the Pocket Casts iOS and Pocket Casts Android open-source apps. Each includes a diverse set of components such as ViewControllers and SwiftUI screens.

Here's how the benchmarks were conducted:

  • Configuration: Full 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 an iPhone 14 Pro and a Pixel 2XL. Note that active Session Replay recording can introduce slow frames on older lower-end iOS devices (for example iPhone 8).

iOS

Metric Sentry SDK only Sentry + Replay SDK
FPS 55 fps 53 fps
Memory 102 MB 121 MB
CPU 4% 13%
App Startup Time (Cold) 1264.80 ms 1265 ms
Main Thread Time n/a 43ms
Network Bandwidth n/a 10 KB/s of recording

Android

Metric Sentry SDK only Sentry + Replay SDK
FPS 55 fps 54 fps
Memory 255 MB 265 MB
CPU 36% 42%
App Startup Time (Cold) 1533.35 ms 1539.55 ms
Main Thread Time n/a 20ms
Network Bandwidth n/a 7 KB/s of recording

Reducing Performance Overhead

To minimize the performance impact of the Replay SDK on iOS and Android, consider lowering the quality of captured screenshots and videos. Setting the replaysSessionQuality to low can significantly reduce CPU, memory, and network bandwidth usage on mobile devices. Here's how you can do it:

  import * as Sentry from '@sentry/react-native';

  Sentry.init({
    replaysSessionSampleRate: 1.0,
    replaysSessionQuality: 'low',
    integrations: [Sentry.mobileReplayIntegration()],
  });

Note that the default value for replaysSessionQuality is medium and a high quality setting is also available.

Excluding Session Replay from Android

If you don’t plan to use Session Replay, you can exclude the sentry-android-replay module from your Android targets to reduce the bundle size by about 40KB compressed and 80KB uncompressed. Here's how you can do it:

// from the android's root build.gradle file
subprojects {
  configurations.all {
    exclude group: 'io.sentry', module: 'sentry-android-replay'
  }
}