Skip to content

Limit crane copy parallelism to 4 concurrent jobs in ECR mirroring#2722

Open
AndreKurait wants to merge 1 commit intoopensearch-project:mainfrom
AndreKurait:reduce-crane-parallelism
Open

Limit crane copy parallelism to 4 concurrent jobs in ECR mirroring#2722
AndreKurait wants to merge 1 commit intoopensearch-project:mainfrom
AndreKurait:reduce-crane-parallelism

Conversation

@AndreKurait
Copy link
Copy Markdown
Member

@AndreKurait AndreKurait commented Apr 15, 2026

Summary

The mirror_images_to_ecr function in mirrorToEcr.sh previously launched all crane copy operations 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 copy operations at 4. Before launching each background job, the loop checks the number of running background processes (jobs -rp) and blocks with wait -n if the limit is reached.

Test Plan

  • Manual testing of the mirroring script with a representative image list
  • Verified the throttling logic works correctly with bash job control

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
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.43%. Comparing base (abe6949) to head (1058f04).
⚠️ Report is 9 commits behind head on main.

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     
Flag Coverage Δ
gradle 69.85% <ø> (+0.22%) ⬆️
node 90.97% <ø> (ø)
python 77.75% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant