Support streaming the download and extraction of zstd bundles#2538
Merged
henrymercer merged 13 commits intomainfrom Oct 14, 2024
Merged
Support streaming the download and extraction of zstd bundles#2538henrymercer merged 13 commits intomainfrom
henrymercer merged 13 commits intomainfrom
Conversation
Behind a feature flag
Contributor
Author
|
I think I'm running a newer version of npm on my machine which is reformatting the |
Contributor
|
Pushed a commit to update the checked-in dependencies. Please mark the PR as ready for review to trigger PR checks. |
angelapwen
approved these changes
Oct 14, 2024
Contributor
angelapwen
left a comment
There was a problem hiding this comment.
Looks good to me 👍 thanks for adding the tests!
Comment on lines
+143
to
+147
| [Feature.ZstdBundleStreamingExtraction]: { | ||
| defaultValue: false, | ||
| envVar: "CODEQL_ACTION_ZSTD_BUNDLE_STREAMING_EXTRACTION", | ||
| minimumVersion: undefined, | ||
| }, |
Contributor
There was a problem hiding this comment.
💡 This flag should be set only when the ZstdBundle flag is also set to true, right? What happens in the case the streaming flag is set and the ZstdBundle isn't — we just fall back to gzip regardless, right?
Contributor
Author
There was a problem hiding this comment.
Yeah, if the ZstdBundle flag isn't set, this flag has no effect.
This was referenced Oct 22, 2024
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
We can save time installing the bundle by streaming the download and extraction phases, so that CPU time previously spent waiting on the network can now be spent extracting what we've received so far.
Some implementation notes:
Streaming is enabled behind a feature flag.
We implement streaming only for Zstandard so that in the event of a bug with streaming, we can fallback to a download first then extract method.
The Actions toolkit HTTP client downloads the full response body, so we can't use it to stream the extraction. Therefore, we use the lower-level Node APIs. But these don't handle redirects, so we add a dependency on
follow-redirectsto avoid implementing error-prone redirect handling ourselves.We add some performance measurements so we can see how much faster streaming is compared to downloading first then extracting.
This PR also adds some logging improvements to the setup CodeQL step, removing the verbose tar extraction output, and only echoing commands for which we're streaming the output.
Merge / deployment checklist