From 3fd93463aa01e880a34a02cf5201fa5ffc13469d Mon Sep 17 00:00:00 2001 From: Karl Heinz Struggl Date: Tue, 10 Dec 2024 13:04:27 +0100 Subject: [PATCH 1/5] adds SDK overhead docs for dart and flutter --- docs/platforms/dart/overhead/index.mdx | 33 +++++++++++++++++ docs/platforms/flutter/overhead/index.mdx | 43 +++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 docs/platforms/dart/overhead/index.mdx create mode 100644 docs/platforms/flutter/overhead/index.mdx diff --git a/docs/platforms/dart/overhead/index.mdx b/docs/platforms/dart/overhead/index.mdx new file mode 100644 index 0000000000000..45651340700f6 --- /dev/null +++ b/docs/platforms/dart/overhead/index.mdx @@ -0,0 +1,33 @@ +--- +title: SDK Overhead +description: "Learn about Sentry's Dart SDK overhead." +sidebar_order: 7500 +--- + +Adding new features or dependencies to your app incurs additional costs on resources - CPU time, memory usage, and network bandwidth, among other things. Sentry SDKs are no different. This document adds transparency to the possible overhead that using our SDK can add, and help you find the feature set and configurations that work best for you. + +## General Approach + +The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. + +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path - on Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. + +If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can. + +## Error Monitoring + +During regular operation, error monitoring incurs little to no overhead. Once an error or crash occurs, the user experience is compromised, and any crash handling routines operate under time constraints imposed by the system. This means that these implementations are highly optimized to perform the required work as quickly as possible. + +The SDK also provides methods to manually capture events: `captureError` and `captureMessage`. These methods perform some complex operations, such as capturing stack trace information, and while they are highly optimized as well, calling them in tight loops should be avoided. + +## Breadcrumbs + +Breadcrumbs are collected through automated integrations or by manually adding them. To have them readily available for every event generated by the SDK, they are continuously persisted, and managed in a performant buffer. This shouldn't impact user experience. + +Capturing excessive numbers of breadcrumbs (for example, creating breadcrumbs for all log messages) can cause significant performance overhead. To mitigate this, review and adapt your app's usage of breadcrumbs. For example, increase the min-level of log messages that create breadcrumbs from `warn` to `error`. + +Note that increasing the max number of breadcrumbs **does not** improve performance and can even have a detrimental effect. + +## Tracing and Performance Monitoring + +As stated in our product docs on the topic, Tracing adds some overhead, but should have minimal impact on the performance of your application. In typical scenarios, the expected overhead is less than 3% of the app's resource utilization. diff --git a/docs/platforms/flutter/overhead/index.mdx b/docs/platforms/flutter/overhead/index.mdx new file mode 100644 index 0000000000000..3058172d56842 --- /dev/null +++ b/docs/platforms/flutter/overhead/index.mdx @@ -0,0 +1,43 @@ +--- +title: SDK Overhead +description: "Learn about Sentry's Flutter SDK overhead." +sidebar_order: 7500 +--- + +Adding new features or dependencies to your app incurs additional costs on resources - CPU time, memory usage, and network bandwidth, among other things. Sentry SDKs are no different. This document adds transparency to the possible overhead that using our SDK can add, and help you find the feature set and configurations that work best for you. + +## General Approach + +The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. + +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path - on Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. + +If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can. + +## Error Monitoring + +During regular operation, error monitoring incurs little to no overhead. Once an error or crash occurs, the user experience is compromised, and any crash handling routines operate under time constraints imposed by the system. This means that these implementations are highly optimized to perform the required work as quickly as possible. + +The SDK also provides methods to manually capture events: `captureError` and `captureMessage`. These methods perform some complex operations, such as capturing stack trace information, and while they are highly optimized as well, calling them in tight loops should be avoided. + +## Screenshots and View Hierarchy + +If you activate these features, the SDK will capture Screenshots and View Hierarchy of the app's UI at the time of an error or crash. This incurs a small overhead that is unnoticeable during normal operation. + +If your app raises many errors in a tight loop, it can become too much to process quickly enough, and UI jank can be the result, so make sure you handle such cases appropriately. + +## Breadcrumbs + +Breadcrumbs are collected through automated integrations or by manually adding them. To have them readily available for every event generated by the SDK, they are continuously persisted, and managed in a performant buffer. This shouldn't impact user experience. + +Capturing excessive numbers of breadcrumbs (for example, creating breadcrumbs for all log messages) can cause significant performance overhead. To mitigate this, review and adapt your app's usage of breadcrumbs. For example, increase the min-level of log messages that create breadcrumbs from `warn` to `error`. + +Note that increasing the max number of breadcrumbs **does not** improve performance and can even have a detrimental effect. + +## Tracing and Performance Monitoring + +As stated in our product docs on the topic, Tracing adds some overhead, but should have minimal impact on the performance of your application. In typical scenarios, the expected overhead is less than 3% of the app's resource utilization. + +## Profiling + +As stated in our product docs on the topic, Profiling adds some overhead, but should have minimal impact on the performance of your application. In typical scenarios, the expected overhead is less than 5% of the app's resource utilization. From defc3466757f5a183f0fa762aa68a6e0f950220a Mon Sep 17 00:00:00 2001 From: Karl Heinz Struggl Date: Wed, 11 Dec 2024 12:21:35 +0100 Subject: [PATCH 2/5] update --- docs/platforms/dart/overhead/index.mdx | 2 +- docs/platforms/flutter/overhead/index.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/dart/overhead/index.mdx b/docs/platforms/dart/overhead/index.mdx index 45651340700f6..1a8e64bbcc72f 100644 --- a/docs/platforms/dart/overhead/index.mdx +++ b/docs/platforms/dart/overhead/index.mdx @@ -10,7 +10,7 @@ Adding new features or dependencies to your app incurs additional costs on resou The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. -We also employ various techniques to ensure we don't add strain on the system's resources along the hot path - on Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can. diff --git a/docs/platforms/flutter/overhead/index.mdx b/docs/platforms/flutter/overhead/index.mdx index 3058172d56842..275bb315ac6a0 100644 --- a/docs/platforms/flutter/overhead/index.mdx +++ b/docs/platforms/flutter/overhead/index.mdx @@ -10,7 +10,7 @@ Adding new features or dependencies to your app incurs additional costs on resou The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. -We also employ various techniques to ensure we don't add strain on the system's resources along the hot path - on Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can. From 992842b1bb6c0e1ce2f7662e19bb241de0e3eb4f Mon Sep 17 00:00:00 2001 From: Karl Heinz Struggl Date: Wed, 11 Dec 2024 18:56:22 +0100 Subject: [PATCH 3/5] update --- docs/platforms/dart/overhead/index.mdx | 2 +- docs/platforms/flutter/overhead/index.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/dart/overhead/index.mdx b/docs/platforms/dart/overhead/index.mdx index 1a8e64bbcc72f..7b9e1330f173a 100644 --- a/docs/platforms/dart/overhead/index.mdx +++ b/docs/platforms/dart/overhead/index.mdx @@ -1,6 +1,6 @@ --- title: SDK Overhead -description: "Learn about Sentry's Dart SDK overhead." +description: "Learn about Sentry's Dart SDK overhead and how you can tailor your configuration to minimize it." sidebar_order: 7500 --- diff --git a/docs/platforms/flutter/overhead/index.mdx b/docs/platforms/flutter/overhead/index.mdx index 275bb315ac6a0..d1acc302ab2a4 100644 --- a/docs/platforms/flutter/overhead/index.mdx +++ b/docs/platforms/flutter/overhead/index.mdx @@ -1,6 +1,6 @@ --- title: SDK Overhead -description: "Learn about Sentry's Flutter SDK overhead." +description: "Learn about Sentry's Flutter SDK overhead and how you can tailor your configuration to minimize it." sidebar_order: 7500 --- From 9ffb25a0981a1ed2c8b9bf1b099206f35057d520 Mon Sep 17 00:00:00 2001 From: Karl Heinz Struggl Date: Wed, 11 Dec 2024 09:57:34 -0800 Subject: [PATCH 4/5] Apply suggestions from code review Co-authored-by: Giancarlo Buenaflor --- docs/platforms/dart/overhead/index.mdx | 2 +- docs/platforms/flutter/overhead/index.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/dart/overhead/index.mdx b/docs/platforms/dart/overhead/index.mdx index 1a8e64bbcc72f..f48dccaba7095 100644 --- a/docs/platforms/dart/overhead/index.mdx +++ b/docs/platforms/dart/overhead/index.mdx @@ -10,7 +10,7 @@ Adding new features or dependencies to your app incurs additional costs on resou The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. -We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background isolate, or we postpone processing to a later time if possible. If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can. diff --git a/docs/platforms/flutter/overhead/index.mdx b/docs/platforms/flutter/overhead/index.mdx index 275bb315ac6a0..9aee0017445dd 100644 --- a/docs/platforms/flutter/overhead/index.mdx +++ b/docs/platforms/flutter/overhead/index.mdx @@ -10,7 +10,7 @@ Adding new features or dependencies to your app incurs additional costs on resou The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. -We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background thread, or we postpone processing to a later time if possible. +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background isolate, or we postpone processing to a later time if possible. If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can. From ab527bfa34500fbfcb153deb8dfe38a108c3e636 Mon Sep 17 00:00:00 2001 From: Karl Heinz Struggl Date: Thu, 12 Dec 2024 11:53:34 +0100 Subject: [PATCH 5/5] update --- docs/platforms/dart/overhead/index.mdx | 2 +- docs/platforms/flutter/overhead/index.mdx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/platforms/dart/overhead/index.mdx b/docs/platforms/dart/overhead/index.mdx index 0c4c69429e426..794a621157d07 100644 --- a/docs/platforms/dart/overhead/index.mdx +++ b/docs/platforms/dart/overhead/index.mdx @@ -10,7 +10,7 @@ Adding new features or dependencies to your app incurs additional costs on resou The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. -We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background isolate, or we postpone processing to a later time if possible. +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload some tasks to native implementations, use debouncing when appropriate, or we postpone processing to a later time if possible. If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can. diff --git a/docs/platforms/flutter/overhead/index.mdx b/docs/platforms/flutter/overhead/index.mdx index 5041e55686283..9dad6ee43b84b 100644 --- a/docs/platforms/flutter/overhead/index.mdx +++ b/docs/platforms/flutter/overhead/index.mdx @@ -10,7 +10,7 @@ Adding new features or dependencies to your app incurs additional costs on resou The SDK is designed to have minimal to no impact on user experience. To achieve this, we utilize an array of tools to continuously measure and optimize the performance of our implementations. -We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload processing steps, I/O, and other things to a background isolate, or we postpone processing to a later time if possible. +We also employ various techniques to ensure we don't add strain on the system's resources along the hot path. On Mobile, this very often means that we offload some tasks to native implementations, use debouncing when appropriate, or we postpone processing to a later time if possible. If you find (for example via local Profiling, or using Sentry to improve the performance of your app) that the SDK does not operate within the guidelines mentioned below, please [open an issue](https://github.com/getsentry/sentry-dart/issues/new/choose) on our SDK repo and make sure you provide as much context as you can.