feat: improve performance of the "Saving deployment state" step for Node projects #13305
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 throughnode_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
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
yarn test
passesAll 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 atmBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.