Skip to content

Commit 5328a93

Browse files
authored
chore(replay): Clarify network bandwidth and show how to reduce perf impact for mobile SDKs (#12479)
1 parent 3d5906d commit 5328a93

File tree

3 files changed

+62
-4
lines changed

3 files changed

+62
-4
lines changed

docs/platforms/android/session-replay/performance-overhead.mdx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Below are the results of the benchmarking tests, presented as median values to r
2929
| CPU | 36% | 42% |
3030
| App Startup Time (Cold) | 1533.35 ms | 1539.55 ms |
3131
| Main Thread Time | n/a | 20ms |
32-
| Network Bandwidth | n/a | 35 KB |
32+
| Network Bandwidth | n/a | 7 KB/s of recording |
3333

3434

3535

@@ -38,3 +38,32 @@ Below are the results of the benchmarking tests, presented as median values to r
3838
Jetpack Compose view hierarchies may be slower to snapshot initially due to ART optimizations, compared to the traditional Android View System. But their performance improves as execution progresses.
3939

4040
</Alert>
41+
42+
## Reducing Performance Overhead
43+
44+
To minimize the performance impact of the Replay SDK, consider the following steps:
45+
46+
### Change Replay quality
47+
48+
Lowering the quality of captured screenshots and videos can significantly reduce CPU, memory, and network bandwidth usage. Here's how you can do it:
49+
50+
```kotlin
51+
SentryAndroid.init(context) { options ->
52+
// this will reduce screenshot compression to 10 and bitrate to 50kbps
53+
options.sessionReplay.quality = SentryReplayQuality.LOW // defaults to MEDIUM
54+
}
55+
```
56+
57+
### Disable Replay for Low-End Devices
58+
59+
If the Replay SDK causes performance issues on lower-end devices (for example, [this](https://github.com/getsentry/relay/blob/695b459e03481f7d799f07b2b901b140e5d5753d/relay-event-schema/src/protocol/device_class.rs#L21-L37) is how Sentry determines the device class), you can disable it specifically for those devices:
60+
61+
```kotlin
62+
SentryAndroid.init(context) { options ->
63+
options.dsn = "___PUBLIC_DSN___"
64+
options.isDebug = true
65+
66+
options.sessionReplay.onErrorSampleRate = if (isLowEnd()) 0.0 else 1.0
67+
options.sessionReplay.sessionSampleRate = if (isLowEnd()) 0.0 else 0.1
68+
}
69+
```

docs/platforms/apple/guides/ios/session-replay/performance-overhead.mdx

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,33 @@ Below are the results of the benchmarking tests, presented as median values to r
2929
| CPU | 4% | 13% |
3030
| App Startup Time (Cold) | 1264.80 ms | 1265 ms |
3131
| Main Thread Time | n/a | 43ms |
32-
| Network Bandwidth | n/a | 50 KB |
32+
| Network Bandwidth | n/a | 10 KB/s of recording|
33+
34+
## Reducing Performance Overhead
35+
36+
To minimize the performance impact of the Replay SDK, consider the following steps:
37+
38+
### Change Replay quality
39+
40+
Lowering the quality of captured screenshots and videos can significantly reduce CPU, memory, and network bandwidth usage. Here's how you can do it:
41+
42+
```swift
43+
SentrySDK.start(configureOptions: { options in
44+
// this will reduce screenshot compression to 10 and bitrate to 50kbps
45+
options.sessionReplay.quality = .low // defaults to .medium
46+
})
47+
```
48+
49+
### Disable Replay for Low-End Devices
50+
51+
If the Replay SDK causes performance issues on lower-end devices (for example, [this](https://github.com/getsentry/relay/blob/695b459e03481f7d799f07b2b901b140e5d5753d/relay-event-schema/src/protocol/device_class.rs#L21-L37) is how Sentry determines the device class), you can disable it specifically for those devices:
52+
53+
```kotlin
54+
SentrySDK.start(configureOptions: { options in
55+
options.dsn = "___PUBLIC_DSN___"
56+
options.debug = true
57+
58+
options.sessionReplay.onErrorSampleRate = if isLowEnd() { 0.0 } else { 1.0 }
59+
options.sessionReplay.sessionSampleRate = if isLowEnd() { 0.0 } else { 0.1 }
60+
})
61+
```

docs/platforms/react-native/session-replay/performance-overhead.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The benchmarks were run on an iPhone 14 Pro and a Pixel 2XL. Note that active Se
3030
| CPU | 4% | 13% |
3131
| App Startup Time (Cold) | 1264.80 ms | 1265 ms |
3232
| Main Thread Time | n/a | 43ms |
33-
| Network Bandwidth | n/a | 50 KB |
33+
| Network Bandwidth | n/a | 10 KB/s of recording|
3434

3535

3636

@@ -43,4 +43,4 @@ The benchmarks were run on an iPhone 14 Pro and a Pixel 2XL. Note that active Se
4343
| CPU | 36% | 42% |
4444
| App Startup Time (Cold) | 1533.35 ms | 1539.55 ms |
4545
| Main Thread Time | n/a | 20ms |
46-
| Network Bandwidth | n/a | 35 KB |
46+
| Network Bandwidth | n/a | 7 KB/s of recording |

0 commit comments

Comments
 (0)