aws / aws-sdk-net

The official AWS SDK for .NET. For more information on the AWS SDK for .NET, see our web site:
http://aws.amazon.com/sdkfornet/
Apache License 2.0
2.07k stars 860 forks source link

Allow full SDK client initialization for newly created clients based on environment variable #2007

Open aal80 opened 2 years ago

aal80 commented 2 years ago

Describe the feature

When creating a new Client object, the client is not fully initialized until the first request is made. It looks like internal components/dependencies are loaded lazily on first client usage. While this might be the desired behavior in some scenarios, this is not always the case. This feature request is for a way to force full client initialization when creating new client objects, preferably using an environment variable.

Use Case

Using the AWS .NET SDK with .NET Lambda functions When runing a sequence of SDK requests from a Lambda function configured with default settings, it was observed that the first request always takes significantly longer, up to x100 longer in some cases (~2500ms vs ~25ms). This was tested with AmazonDynamoDBClient and AmazonSimpleSystemsManagerClient. The result is a degraded UX for the first function invocation, which is very noticable when developing Lambdas. image image

Proposed Solution

Introduce environment variable that will force full client initialization when present.

Other Information

No response

Acknowledgements

AWS .NET SDK and/or Package version used

3.7.3

Targeted .NET Platform

.NET Core 3.1, .NET 6

Operating System and version

Windows

ashishdhingra commented 2 years ago

Needs review with the team. Ideally this should be a cross SDK feature request.