.Net core DI resolution of IAmazonDynamoDb takes 10+ seconds #3027
-
I'm using IAmazonDynamoDb as a dynamodb client to perform some low-level dynamo db queries like ScanAsync, UpdateItemAsync etc.. and I've noticed that it takes more than 10 seconds to resolve a service that uses IAmazonDynamoDb as a dependency for the first time. So I can assume that probably during construction of IAmazonDynamoDb instance it makes some network calls to populate caches etc.. Is my assumption correct and if yes is there any way to speed up this process? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
@minus-5 Good afternoon. Thanks for starting the discussion. Could you please share sample code to reproduce the issue? |
Beta Was this translation helpful? Give feedback.
-
Hello @ashishdhingra, I've uploaded a sample project that reproduces the issue https://github.com/minus-5/awssdk-issueRepro |
Beta Was this translation helpful? Give feedback.
-
@minus-5 At high level, when using DI, AWSSDK.Extensions.NETCore.Setup would:
In case on DynamoDB, spending on the operation used, it also populates internal config (as pointed out by you). Could you try enabling client side verbose logging using below minimal statements (before the code which configures DI) and see if you are able to capture detailed logs: Amazon.AWSConfigs.LoggingConfig.LogResponses = Amazon.ResponseLoggingOption.Always;
Amazon.AWSConfigs.LoggingConfig.LogTo = Amazon.LoggingOptions.SystemDiagnostics;
Amazon.AWSConfigs.AddTraceListener("Amazon", new System.Diagnostics.ConsoleTraceListener()); You may also try setting Thanks, |
Beta Was this translation helpful? Give feedback.
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
@minus-5 In your case, the credential resolution is failing after it tries all the credential generators. Do you have:
default
profile configured in yourcredentials
file?, OR,AWS_PROFILE
environment variable set?Could you please clarify what do you mean by
directly connecting to AWS
? Almost all AWS service API(s) require credentials of some form (either long term or short team). Could you please share the code which reproduces the issue?Thanks,
Ashish