getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.56k stars 330 forks source link

App performance critically impacted by mobileReplayIntegration on iOS (iPhone X) #3959

Open falk-stefan opened 1 month ago

falk-stefan commented 1 month ago

OS:

Platform:

SDK:

SDK version: 5.26.0

react-native version: 0.74.3

Are you using Expo?

Are you using sentry.io or 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 commented 1 month ago

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 commented 1 month ago

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.

brustolin commented 1 month ago

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 commented 1 month ago

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?

yefim commented 1 month ago

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 https://github.com/getsentry/sentry-react-native/issues/3963#issuecomment-2265966871

krystofwoldrich commented 1 month ago

@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 commented 1 month ago

@krystofwoldrich yes, it was the captureConsoleIntegration causing the slowness. I had not enabled the Mobile Replay feature. I filed https://github.com/getsentry/sentry-react-native/issues/3992