-
Notifications
You must be signed in to change notification settings - Fork 862
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
Performance Issues: Slow Initial Calls #3555
Comments
@MuadDib Good afternoon. Could you please review if your issue is similar to #3551. Also, could you enable verbose logs and metrics using below code and share the same: Amazon.AWSConfigs.LoggingConfig.LogResponses = Amazon.ResponseLoggingOption.Always;
Amazon.AWSConfigs.LoggingConfig.LogTo = Amazon.LoggingOptions.Console;
Amazon.AWSConfigs.LoggingConfig.LogMetrics = true;
Amazon.AWSConfigs.AddTraceListener("Amazon", new System.Diagnostics.ConsoleTraceListener()); Verbose logs would enable us to measure the latency on .NET SDK side. Also refer to #3551 (comment) if that helps. Looks like your execution environment is Lambda. Initial latency could also be caused by Lambda cold starts. You may also explore new feature Improving startup performance with Lambda SnapStart to improve initial latency. Thanks, |
Hello Ashish, Thank you for your reply! Could you please let me know the approximate response time expected for the first request? I’m specifically wondering whether it falls within a range of tens of milliseconds or hundreds of milliseconds. Additionally, do you know of any resources that showcase the performance of the .NET client? I’m particularly interested in understanding the expected response time for the first request. I understand that this has been identified as an issue, and you’re working to improve it in the next version of the client. However, it would be extremely helpful to know the expected response times for both the current version and the improved version. Even if you don’t have precise data, an approximate timing would still be very valuable to me. To give some context about our tech stack: Our lambdas are optimized for minimal cold-start times, typically just a few milliseconds. However, this optimization becomes irrelevant if the connection to DynamoDB takes a long time to initialize. Since lambdas have a very short lifecycle (often only a few minutes before AWS destroys the running container), a lengthy initialization time for DynamoDB becomes a critical issue that could halt our progress. Thank you for your insights and assistance! PS as per your request I added the logging and simplified the code:
Full log: log.txt
These are example metrics that we see for the Initial call vs subsequent call:
|
After conducting further investigation into the issue, I drew inspiration from similar challenges reported in the Java SDK, particularly those described in this GitHub issue. My aim was to evaluate whether changes in allocated memory for the Lambda function would influence the response time from DynamoDB. As part of this analysis, I tested the The results of my experiments are summarized in the graphs below: Key Findings
Based on these results, it appears that the .NET DynamoDB client may not be well-suited for our performance requirements. |
Describe the bug
We've observed that the initial call to DynamoDB is quite slow, often exceeding 2000ms, and sometimes even approaching 10,000ms. Subsequent calls improve significantly (usually under 20ms), but we occasionally see slower calls (500ms+) after periods of inactivity.
We are seeing the same performance using both IDynamoDBContext and the IAmazonDynamoDB.
We tried using strategies outlined here to improve the situation but no luck. I even tried hardcoding the accessKey but to no avail.
Regression Issue
Expected Behavior
Client execution time even for the first request should not be an outlier by such a huge margin.
Current Behavior
Example of metrics for the first request vs followup request
Reproduction Steps
Minimal code directly copied from tutorials exhibit the same issue. I pasted an example in lambda for
IDynamoDBContext
, but it's the same executing from ECS container.Possible Solution
No response
Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Targeted .NET Platform
net8.0
Operating System and version
Lambda
The text was updated successfully, but these errors were encountered: