Skip to content

Improve Session Replay performance on iOS #3959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
6 of 11 tasks
falk-stefan opened this issue Jul 20, 2024 · 22 comments
Closed
6 of 11 tasks

Improve Session Replay performance on iOS #3959

falk-stefan opened this issue Jul 20, 2024 · 22 comments

Comments

@falk-stefan
Copy link

falk-stefan commented Jul 20, 2024

OS:

  • Windows
  • MacOS
  • Linux (Ubuntu)

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.26.0

react-native version: 0.74.3

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

Configuration:

(@sentry/react-native)

Sentry.init({
  environment: environment.env,
  dsn: environment.sentry.dsn,
  sampleRate: environment.env === 'production' ? 0.05 : 1.0,
  tracePropagationTargets: [environment.apiUrl],
  _experiments: {
    // Currently under _experiments for 5.26.0-alpha releases
    replaysSessionSampleRate: 0.01,
    replaysOnErrorSampleRate: 1.0,
  },
  defaultIntegrations: [
    Sentry.mobileReplayIntegration({
      maskAllText: false,
      maskAllImages: false,
    }),
  ],
});

I have the following issue:

For testing, I have two phones available. One Galaxy A33 5G and an iPhone X.

After making my first iOS build I noticed that the application way really slow. Scrolling would sometimes completely getting stuck on the iOS device. However, I didn't have any issues on the Android device.

Long story short: After some thinking what the issue might be, I removed the Sentry.mobileReplayIntegration and noticed that the iPhone X was able to perform normally.

I am not sure if this is due to the device being comparatively old. However, the iPhone X isn't terribly weak. Not sure if this can be improved but I thought I'd just bring it up here just in case this isn't a known issue.

Expected result:

No significant performance impact.

@brustolin
Copy link
Contributor

Hello @falk-stefan Thanks for reaching out.

We will investigate the impact on performance.
Were you testing this on debug alone, or did you try a release build?

I removed the Sentry.mobileReplayIntegration and noticed that the iPhone X was able to perform normally.

You mean, when the redact was enabled, there were no performance issues?

@falk-stefan
Copy link
Author

Hi!

Were you testing this on debug alone, or did you try a release build?

I used an internal ad-hoc build on a physical iPhone X.

You mean, when the redact was enabled, there were no performance issues?

Essentially, I just commented out the entire section in order to remove the integration like so:

Sentry.init({
  environment: environment.env,
  dsn: environment.sentry.dsn,
  sampleRate: environment.env === 'production' ? 0.05 : 1.0,
  tracePropagationTargets: [environment.apiUrl],
  // _experiments: {
  //   // Currently under _experiments for 5.26.0-alpha releases
  //   replaysSessionSampleRate: 0.01,
  //   replaysOnErrorSampleRate: 1.0,
  // },
  // defaultIntegrations: [
  //   Sentry.mobileReplayIntegration({
  //     maskAllText: false,
  //     maskAllImages: false,
  //   }),
  // ],
});

After installing a new ad-hoc build on the device, the performance was back to normal.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Jul 24, 2024
@brustolin
Copy link
Contributor

Essentially, I just commented out the entire section in order to remove the integration like so

Ok, so you disabled session replay completely.
Thanks for the answers!

@krystofwoldrich
Copy link
Member

krystofwoldrich commented Aug 1, 2024

From the older Apple devices we have iP 6 and 8 (the same chip as X) available, have we tested any of the recent SDK builds on them?

@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs Investigation in [DEPRECATED] Mobile SDKs Aug 2, 2024
@yefim
Copy link

yefim commented Aug 2, 2024

We've narrowed it down to @sentry/integrations version 7.114.0. We're running @sentry/react-native 5.26.0. I posted video and workaround at #3963 (comment)

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Aug 2, 2024
@krystofwoldrich
Copy link
Member

@yefim Thank you for the message and the video, just to confirm, your app was slow when using the captureConsoleIntegration and when removing it, it worked correctly?

Were you also using the Mobile Replay feature?

@yefim
Copy link

yefim commented Aug 5, 2024

@krystofwoldrich yes, it was the captureConsoleIntegration causing the slowness. I had not enabled the Mobile Replay feature. I filed #3992

@krystofwoldrich
Copy link
Member

@1forh Thank you.

@krystofwoldrich
Copy link
Member

We have tested Session Replay recording with iPhone 8 and iPhone 14 Pro and we can confirm the impact on the lower end devices is larger. We recommend enabling SR only on high end iOS devices.

@krystofwoldrich krystofwoldrich moved this from Needs Investigation to Needs Discussion in [DEPRECATED] Mobile SDKs Dec 3, 2024
@krystofwoldrich krystofwoldrich removed their assignment Dec 3, 2024
@LMakshow
Copy link

LMakshow commented Dec 6, 2024

Updated Sentry SDK to 6.4.0 to check the issue again on iPhone 14 Pro. There's still a noticeable scroll stutter which would annoy me as a user. It's not as noticeable as on iPad 7th gen, but I won't recommend pushing it to production to my team.
Also, Xcode shows a warning on this code line alerting about potential priority inversions. Could it help with troubleshooting the issue?

Image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 6, 2024
@krystofwoldrich
Copy link
Member

@brustolin Do you also get the Xcode warning?

@krystofwoldrich krystofwoldrich changed the title App performance critically impacted by mobileReplayIntegration on iOS (iPhone X) Improve Session Replay performance on iOS Dec 10, 2024
@LMakshow
Copy link

To get this warning, you need to build and run the app from Xcode, not from react-native/expo CLI (so Xcode will attach its own debugger).

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 10, 2024
@brustolin
Copy link
Contributor

@brustolin Do you also get the Xcode warning?

This is supposed to be fixed. I will take a look.

@bruno-garcia
Copy link
Member

@LMakshow is the warning still happening? Sorry but Brustolin is no longer at Sentry

@LMakshow
Copy link

@bruno-garcia
We still had the issue of 1/second stutters while testing the iOS replays on the Sentry 6.5.0 version. I didn't check the XCode warnings then. Let me try it a bit later. I might also try to reproduce the issue with the sample app if that might help.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Feb 13, 2025
@kahest kahest moved this from Needs Discussion to Needs More Information in [DEPRECATED] Mobile SDKs Feb 14, 2025
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Feb 14, 2025
@kahest
Copy link
Member

kahest commented Feb 18, 2025

Closing this as duplicate of getsentry/sentry-cocoa#4000. Please add relevant information to the other issue as needed and track the progress there

@kahest kahest closed this as completed Feb 18, 2025
@github-project-automation github-project-automation bot moved this from Needs More Information to Done in [DEPRECATED] Mobile SDKs Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Development

No branches or pull requests

9 participants