aws / aws-sdk-js-v3

Modularized AWS SDK for JavaScript.
Apache License 2.0
2.97k stars 556 forks source link

chore(credential-provider-node): statically import credential-provider-env #6026

Closed trivikr closed 2 months ago

trivikr commented 2 months ago

Issue

Internal JS-5156

Description

Statically imports @aws-sdk/credential-provider-node so that no additional time is spent on Lambda for dynamically importing the provider during request time.

Testing

The unit tests and integration tests are successful.

We benchmarked @aws-sdk/client-dynamodb@v3.556.0 (latest version at the time of PR) listTables operation for 100 counts before and after the change. In this sample benchmark, the request time at p50 is reduced by ~40ms or 4.3% with no change in init_duration.

Before

╔════════════════════════════════════════════╤════════════════════╤════════╤════════╤════════╗
║                                            │ metric             │ p50    │ p90    │ stdDev ║
╟────────────────────────────────────────────┼────────────────────┼────────┼────────┼────────╢
║ [node 20.12.0, x86_64, 128 MB, us-west-1]: │ init_duration (ms) │ 347.35 │ 369.93 │ 23.05  ║
║ Code (esm) with dynamodb list-tables       │ request (ms)       │ 932.98 │ 959.92 │ 64.98  ║
║ v3.556.0 (2.79 MB)                         │                    │        │        │        ║
╚════════════════════════════════════════════╧════════════════════╧════════╧════════╧════════╝

After

╔════════════════════════════════════════════╤════════════════════╤════════╤════════╤════════╗
║                                            │ metric             │ p50    │ p90    │ stdDev ║
╟────────────────────────────────────────────┼────────────────────┼────────┼────────┼────────╢
║ [node 20.12.0, x86_64, 128 MB, us-west-1]: │ init_duration (ms) │ 346.51 │ 371.8  │ 27.3   ║
║ Code (esm) with dynamodb list-tables       │ request (ms)       │ 894.77 │ 935.18 │ 93.3   ║
║ v3.556.0 (2.79 MB)                         │                    │        │        │        ║
╚════════════════════════════════════════════╧════════════════════╧════════╧════════╧════════╝

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

github-actions[bot] commented 1 month ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.