Improve build performance of NodejsFunction on Mac (@aws-cdk/aws-lambda-nodejs package)
See original GitHub issueUsing volumes in Docker on Mac specifically is a huge pain point due to performance issues. CPU often spikes to above 100% utilization when there is heavy read or write operations inside the container (as it happens with the parcel-builder
Docker container that the CDK construct NodejsFunction uses internally.
This has been very well documented in https://docs.docker.com/docker-for-mac/osxfs-caching/ and the workarounds are also described.
I suggest we force Docker volume mounts within this construct to start using Docker volume in “delegated” mode, to improve build performance (speed) on Mac based deployment environments.
I think a good starting point is: https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/aws-lambda-nodejs/lib/builder.ts#L118
Use Case
Developing and deploying CDK stacks with many lambdas on a Mac machine.
Proposed Solution
Replace -v sourcevolume:targetvolume
with -v sourcevolume:targetvolume:delegated
Other
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:11 (11 by maintainers)
Top GitHub Comments
Is there a reason why it runs inside a Docker container anyways? Seems to be a bit heavy handed. I think there should be an option to run it locally.
Other OSs don’t suffer from this performance issue and the “:cached” or “:delegated” flag is a no-op for them.