Repro for aws/aws-cdk#25492
A CDK application which tests cold start latency of lambda functions created with AWS CDK Lambda NodeJsFunction construct.
- Install Node.js by following these steps:
- Install nvm.
- Use node v18.x.x by running
nvm useornvm use 18in a terminal window. - Verify that node is installed by running
node -vin a terminal window and confirm that it shows Node.js >=18, such asv18.16.0). - Enable corepack by running
corepack enablein a terminal window.
- Install dependencies by running
yarn. - Install the AWS CLI and run aws configure.
- Install
measure-cold-startserverless application on your AWS Account.
- Run
yarn cdk deploydeploy this stack to your default AWS account/region. - Run
yarn benchmarkto run the benchmark comparing cold starts between NodejsFunction with Lambda Provided SDK vs Customer Deployed SDK.
$ yarn benchmark --count 1000
{
'NodejsFunction default (uses Lambda Provided SDK)': 1227.1435,
'NodejsFunction custom (uses Customer Deployed SDK)': 929.441
}- Run
yarn cdk destroy. - Delete Cloudformation stack with name
serverlessrepo-measure-cold-startcreated bymeasure-cold-start.