Limit crane copy parallelism to 4 concurrent jobs in ECR mirroring#2722
Open
AndreKurait wants to merge 1 commit intoopensearch-project:mainfrom
Open
Limit crane copy parallelism to 4 concurrent jobs in ECR mirroring#2722AndreKurait wants to merge 1 commit intoopensearch-project:mainfrom
AndreKurait wants to merge 1 commit intoopensearch-project:mainfrom
Conversation
Previously, mirror_images_to_ecr launched all crane copy operations as background jobs simultaneously with no concurrency limit. This could overwhelm network/ECR rate limits when mirroring many images. Adds a semaphore pattern using jobs -rp and wait -n to cap at 4 concurrent copies at a time. Signed-off-by: Andre Kurait <andrekurait@gmail.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2722 +/- ##
============================================
+ Coverage 73.28% 73.43% +0.14%
Complexity 106 106
============================================
Files 721 721
Lines 33372 33372
Branches 2910 2910
============================================
+ Hits 24457 24506 +49
+ Misses 7582 7535 -47
+ Partials 1333 1331 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
The
mirror_images_to_ecrfunction inmirrorToEcr.shpreviously launched allcrane copyoperations as background jobs simultaneously with no concurrency limit. This was observed to cause OOM (out of memory) failures when running in AWS CloudShell, and could also overwhelm ECR API rate limits when mirroring many images.Changes
Adds a semaphore pattern that caps concurrent
crane copyoperations at 4. Before launching each background job, the loop checks the number of running background processes (jobs -rp) and blocks withwait -nif the limit is reached.Test Plan