[@aws-cdk/aws-lambda-nodejs] Bad performance on deployment of NodejsFunction construct, compared to plain Function construct #9639
Labels
@aws-cdk/aws-lambda-nodejs
duplicate
This issue is a duplicate.
guidance
Question that needs advice or information.
in-progress
This issue is being actively worked on.
Whenever I try to deploy a stack that's based mainly on Lambdas, as part of a relatively sized project (20-30 Lambdas), I am faced with a terrible development experience when using a fairly common combination of:
To demonstrate the magnitude of the issue, I created a simple CDK app with a simple CDK stack with 10 identical (almost empty of logic) Lambdas.
In the first scenario, I deploy the stack using .js files and the standard new lambda.Function() construct.
In the second scenario I deploy the stack using .ts files and the new NodejsFunction() construct.
The time difference between both deployments (always starting from a non-existing stack in CloudFormation) is the following:
To help mitigate it to some degree, I contributed a pull request a while ago (#8544) which adds a ":delegated" flag to Docker volumes that build the Lambda inside the NodejsFunction construct. However, apparently, this optimization is not enough for real life development and deployment.
I might be interested in contributing to the solution of this problem, but currently - I'm a bit out of ideas on how to approach it. Suggestions are welcome.
Minimum reproducable code pushed to this temporary repo: https://github.com/Dzhuneyt/aws-cdk-nodejs-function-performance-test
The text was updated successfully, but these errors were encountered: