fix: large amounts of metadata can break 512MB string limit#34480
Merged
mergify[bot] merged 7 commits intomainfrom Mar 6, 2026
Merged
fix: large amounts of metadata can break 512MB string limit#34480mergify[bot] merged 7 commits intomainfrom
mergify[bot] merged 7 commits intomainfrom
Conversation
27b76dd to
046eb38
Compare
aws-cdk-automation
previously requested changes
May 16, 2025
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
matboros
reviewed
May 19, 2025
matboros
reviewed
May 19, 2025
matboros
reviewed
May 19, 2025
Collaborator
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
rix0rrr
added a commit
to aws/aws-cdk-cli
that referenced
this pull request
Jun 3, 2025
When CDK apps grow extremely large (think 10-100 stacks, 1000-10000 constructs), all metadata together begins to exceed 512MB, the maximum string size in NodeJS. People usually deal with this by disabling metadata, but they shouldn't have to. In addition, even for manifests that don't exceed 512MB the extremely large size of the single JSON object slows down its writing and reading every time, even if the metadata doesn't need to be accessed. An effective solution is to write the metadata of an artifact to a separate file. This PR introduces the ability for that into the Cloud Assembly schema, and updates the CLI to read from both sources if available. Relates to aws/aws-cdk#34480.
github-merge-queue bot
pushed a commit
to aws/aws-cdk-cli
that referenced
this pull request
Feb 9, 2026
When CDK apps grow extremely large (think 10-100 stacks, 1000-10000 constructs), all metadata together begins to exceed 512MB, the maximum string size in NodeJS. People usually deal with this by disabling metadata, but they shouldn't have to. In addition, even for manifests that don't exceed 512MB the extremely large size of the single JSON object slows down its writing and reading every time, even if the metadata doesn't need to be accessed. An effective solution is to write the metadata of an artifact to a separate file. This PR introduces the ability for that into the Cloud Assembly schema, and updates the CLI to read from both sources if available. Removes an unused class from the refactoring project that we found through this project because it would have to be refactored. Rather than refactoring, bye-bye! Relates to aws/aws-cdk#34480. --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
17e8374 to
6b989ed
Compare
commit df361bb Merge: f14a874 68bde3b Author: Rico Huijbers <rix0rrr@gmail.com> Date: Fri Feb 13 13:41:58 2026 +0100 Merge branch 'huijbers/synth-perf' of github.com:aws/aws-cdk into huijbers/synth-perf commit f14a874 Merge: 5bbd63a ca4409b Author: Rico Huijbers <rix0rrr@gmail.com> Date: Fri Feb 13 13:41:23 2026 +0100 Merge remote-tracking branch 'origin/main' into huijbers/synth-perf commit 68bde3b Author: Rico Hermans <rix0rrr@gmail.com> Date: Mon May 26 13:16:07 2025 +0200 Update construct-iteration.ts Comments were outdated commit f04ec71 Author: Rico Hermans <rix0rrr@gmail.com> Date: Mon May 26 13:15:42 2025 +0200 Naming was shyte commit 5bbd63a Author: Rico Huijbers <rix0rrr@gmail.com> Date: Fri May 16 13:57:39 2025 +0200 MOve this code over from the other pR commit 046eb38 Author: Rico Huijbers <rix0rrr@gmail.com> Date: Fri May 16 13:49:51 2025 +0200 fix: large amounts of stacks slow down synthesis A large amount of stacks leads to a large body of metadata into the `manifest.json` file. The file can grow too large to be written to disk (>512MB), but even if it doesn't fail outright, serializing and writing and loading a large JSON file takes a lot of CPU time. This PR splits the metadata for stacks off into a separate file which is written separately, moving it out of the hot path of working with the `manifest.json` file. On a tree of 256 stacks and ~40,000 constructs, this shaves off 5 seconds off of the total synthesis time.
6b989ed to
a8aa6cb
Compare
This was referenced Feb 13, 2026
mrgrain
approved these changes
Mar 5, 2026
Contributor
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Contributor
Merge Queue StatusRule:
|
Contributor
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Contributor
|
Comments on closed issues and PRs are hard for our team to see. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
A large amount of stacks leads to a large body of metadata into the
manifest.jsonfile. The file can grow too large to be written to disk (>512MB), but even if it doesn't fail outright, serializing and writing and loading a large JSON file takes a lot of CPU time.This PR splits the metadata for stacks off into a separate file which is written separately, moving it out of the hot path of working with the
manifest.jsonfile. On a tree of 256 stacks and ~40,000constructs, this shaves off 5 seconds off of the total synthesis time.
Also in this PR:
CloudArtifactexposes ametadatagetter that reads from manifest or file, whichever is available. Expose here as well for completeness.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license