-
Notifications
You must be signed in to change notification settings - Fork 510
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
Slow Initialization Time for Sentry SDK in AWS Lambda #3763
Comments
@kalyan-koneru thank you for the feedback. First of all, when measuring the time it takes for the Sentry SDK to initialize, you should use The problem with I don't find it that surprising though that there is some delay to initializing the Sentry SDK. We need to do quite a bit of work to instrument your application properly with the SDK, so it is no surprise that this does add a delay. Did you notice a sudden performance regression from a previous version of the Sentry SDK, or has it always been like this for you? |
Thank you for the clarification on using time.process_time_ns() to measure initialization time more accurately. We were indeed using time.time() and will switch to time.process_time_ns() to get a clearer view of the SDK's active processing time. Regarding performance, we haven't specifically checked for regressions in the current version of the Sentry SDK. This issue came to our attention while investigating cold startup times in our Python application, where we observed the Sentry SDK initialization taking around 500ms. Do you consider this a reasonable performance expectation, or are there optimizations we could look into? |
@kalyan-koneru Could you first try timing the import and initialization with It's hard to tell whether a 500ms duration measured with |
How do you use Sentry?
Sentry Saas (sentry.io)
Version
2.18.0
Steps to Reproduce
While implementing a simple AWS Lambda function, I observed significant delays related to Sentry SDK initialization. Specifically:
0 ms.
These delays contribute to an increased cold start time for AWS Lambda functions, which could impact performance in latency-sensitive applications.
I have attached the lambda function I used to test the performance
Expected Result
Expect the sentry initialization time to be under 50ms
Actual Result
Sentry initialization time is over 500ms
Elapsed time import sentry_sdk: 304 ms
Elapsed time sentry_sdk.init: 257 ms
The text was updated successfully, but these errors were encountered: