-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix(s3-deployment): optimize memory usage for large files #34020
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f77ebcb
fix(s3-deployment): optimize memory usage for large files
scorbiere a2670fa
Merge branch 'main' into issue_34002
scorbiere c34541e
Merge branch 'main' into issue_34002
scorbiere a08216e
fix(s3-deployment): add jsonAwareSourceProcessing option to optimize …
scorbiere 63209ec
Update integ test snapshot
scorbiere 66ad9fe
Change the json processing strategy.
scorbiere 1963fc4
Merge branch 'main' into issue_34002
scorbiere 6d634ca
Update snapshot
scorbiere eace5ef
Update some snapshot and complete the `jsonAwareSourceProcessing` int…
scorbiere a44cf62
Update snapshot
scorbiere c570d14
Update snapshot with dry-run
scorbiere c34c6b9
Merge branch 'main' into issue_34002
godwingrs22 3483752
Improve Source.jsonData API with structured options
scorbiere 095fba4
Update integ test snapshot and add a case without json escaping
scorbiere 02fdd80
Merge branch 'main' into issue_34002
scorbiere ecf172f
Fix README
scorbiere 2d102ac
Fix README
scorbiere c36a6e1
Merge branch 'main' into issue_34002
scorbiere File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
16 changes: 16 additions & 0 deletions
16
...ustom-resource-handlers/test/aws-s3-deployment/bucket-deployment-handler/Dockerfile_large
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
FROM public.ecr.aws/lambda/python:latest | ||
|
||
# add everything to /opt/awscli (this is where \`aws\` is executed from) | ||
ADD . /opt/awscli | ||
|
||
# install boto3, which is available on Lambda | ||
RUN pip3 install boto3 PyYAML | ||
|
||
# Set working directory | ||
WORKDIR /opt/awscli | ||
|
||
# Make the script executable | ||
RUN chmod +x run_individual_tests.sh | ||
|
||
# Run tests individually | ||
ENTRYPOINT ["./run_individual_tests.sh"] |
36 changes: 36 additions & 0 deletions
36
...esource-handlers/test/aws-s3-deployment/bucket-deployment-handler/run_individual_tests.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
# Script to run each test individually for more accurate memory measurements | ||
|
||
echo "Running tests individually to get accurate memory measurements..." | ||
|
||
# Initialize test files first | ||
echo -e "\n\n=== Initializing Test Files ===" | ||
TEST_DIR=$(python3 -m test_large_files --init | grep "TEST_DIR=" | cut -d'=' -f2) | ||
echo -e "\n\nTest directory: $TEST_DIR" | ||
|
||
# Run each test individually with the pre-created files | ||
echo -e "\n\n=== Small JSON File Test ===" | ||
python3 -m test_large_files --test test_small_json_file_performance --test-dir "$TEST_DIR" | ||
|
||
echo -e "\n\n=== Large JSON File Test ===" | ||
python3 -m test_large_files --test test_large_json_file_performance --test-dir "$TEST_DIR" | ||
|
||
echo -e "\n\n=== Complex JSON File Test ===" | ||
python3 -m test_large_files --test test_complex_json_file_performance --test-dir "$TEST_DIR" | ||
|
||
echo -e "\n\n=== Small Text File Test ===" | ||
python3 -m test_large_files --test test_small_text_file_performance --test-dir "$TEST_DIR" | ||
|
||
echo -e "\n\n=== Large Text File Test ===" | ||
python3 -m test_large_files --test test_large_text_file_performance --test-dir "$TEST_DIR" | ||
|
||
echo -e "\n\n=== Complex JSON File with no markers Test ===" | ||
python3 -m test_large_files --test test_complex_json_file_no_marker_performance --test-dir "$TEST_DIR" | ||
|
||
echo -e "\n\n=== Complex JSON File with double quote markers Test ===" | ||
python3 -m test_large_files --test test_complex_json_file_double_quote_marker_performance --test-dir "$TEST_DIR" | ||
|
||
echo -e "\n\nAll tests completed." | ||
|
||
# Clean up test files | ||
rm -rf "$TEST_DIR" |
25 changes: 25 additions & 0 deletions
25
...esource-handlers/test/aws-s3-deployment/bucket-deployment-handler/run_large_file_tests.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
#--------------------------------------------------------------------------------------------------- | ||
# executes large file tests | ||
# | ||
# prepares a staging directory with the requirements | ||
set -e | ||
scriptdir=$(cd $(dirname $0) && pwd) | ||
|
||
rm -f ${scriptdir}/index.py | ||
rm -fr ${scriptdir}/__pycache__ | ||
|
||
# prepare staging directory | ||
staging=$(mktemp -d) | ||
mkdir -p ${staging} | ||
cd ${staging} | ||
|
||
# copy src and overlay with test | ||
cp -f ${scriptdir}/../../../lib/aws-s3-deployment/bucket-deployment-handler/* $PWD | ||
cp -f ${scriptdir}/* $PWD | ||
|
||
# Build the Docker image with --no-cache to force rebuild | ||
DOCKER_CMD=${CDK_DOCKER:-docker} | ||
$DOCKER_CMD build -f Dockerfile_large --no-cache -t s3-deployment-test . | ||
|
||
$DOCKER_CMD run --rm s3-deployment-test |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How and where/when does this test get run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are manually run by the developer when testing their changes on the custom resource's code.