Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: improve performance of the "Saving deployment state" step for Node projects #13305

Conversation

ErlendHer
Copy link
Contributor

@ErlendHer ErlendHer commented Oct 4, 2023

Description of changes

When uploading studio backend files, there is a glob that scans through all files/folders in the amplify project directory. For Amplify projects where there are multiple Node projects, this is problematic as scanning through node_modules can be very resource intensive.

Below are some benchmarks that were performed for my teams Amplify project (we currently have 40 Node lambda functions, and 6 custom resources written in JavaScript and thus having node_modules)

This is the benchmark before the suggested change below

Task Time
Zipping the #current-cloud-backend 1.886s
Uploading the .zip file 7.487s
Deleting the old S3 directory from studio-backend 898ms
Performing the glob on the amplify directory 6 minutes 41 seconds
Uploading the studio-backend files to S3 558ms

After running the same benchmark with the proposed changes, all of the steps remained roughly the same, except for
the glob which was reduced to 1.3 seconds. For our project, this is very significant, as this saves us almost 7 minutes per deploy.

Issue #13301

Description of how you validated changes

Ran amplify push both before and after and benchmarked the results for our production project. Noticed closed to a 7 minute decrease in deployment time

Checklist

All tests are passing except for the featureFlags.test.ts, which should not be relevant to the changes I've made, not sure if this is a local setup issue or if tests in dev are not passing atm

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ErlendHer ErlendHer requested a review from a team as a code owner October 4, 2023 18:13
@ykethan ykethan linked an issue Oct 4, 2023 that may be closed by this pull request
2 tasks
…vider-awscloudformation/saving-deployment-state-node-optimization
@ErlendHer ErlendHer changed the title Improve performance of the "Saving deployment state" step for Node projects feat: improve performance of the "Saving deployment state" step for Node projects Oct 13, 2023
@rtpascual rtpascual merged commit 5cc1b55 into aws-amplify:dev Oct 17, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saving Deployment State is extremely slow due to unoptimized glob
3 participants