Closed mk0sojo closed 11 months ago
We recommend creating a bundled application if cold start times are a concern.
When I bundle it it takes around 450 ms for a cold start which is similar to v2 I think.
@mk0sojo I am glad to hear that bundling the SDK helped you in reducing the cold start times. It is actually what we recommend as @kuhe said. I am going to resolve this issue now, but please if you have anything else that we can help you with, feel free of opening a new issue.
Thanks!
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.
Checkboxes for prior research
Describe the bug
Currently upgrading from AWS SDK v2 to AWS SDK v3 and importing @aws-sdk/client-xxx is slower than I would expect and is causing very slow cold starts (close to 1 second).
SDK version number
@aws-sdk/client-dynamodb@latest, @aws-sdk/client-s3, @aws-sdk/client-ssm
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node 18 lambda
Reproduction Steps
Function Logs START RequestId: 12248941-44db-4e8c-93fa-458c0080ad45 Version: $LATEST END RequestId: 12248941-44db-4e8c-93fa-458c0080ad45 REPORT RequestId: 12248941-44db-4e8c-93fa-458c0080ad45 Duration: 2.66 ms Billed Duration: 3 ms Memory Size: 1024 MB Max Memory Used: 67 MB Init Duration: 172.79 ms
import { DynamoDBClient, GetItemCommand } from "@aws-sdk/client-dynamodb" import { S3Client, GetObjectCommand } from "@aws-sdk/client-s3"; import { SSMClient, GetParameterCommand } from "@aws-sdk/client-ssm";
export const handler = async (event) => { // TODO implement const response = { statusCode: 200, body: JSON.stringify('Hello from Lambda!'), }; return response; };
Response { "statusCode": 200, "body": "\"Hello from Lambda!\"" }
Function Logs START RequestId: fa753048-9567-4836-b9e7-278df1a9767f Version: $LATEST END RequestId: fa753048-9567-4836-b9e7-278df1a9767f REPORT RequestId: fa753048-9567-4836-b9e7-278df1a9767f Duration: 2.56 ms Billed Duration: 3 ms Memory Size: 1024 MB Max Memory Used: 115 MB Init Duration: 917.74 ms
Request ID fa753048-9567-4836-b9e7-278df1a9767f