-
Notifications
You must be signed in to change notification settings - Fork 552
Add --max-concurrent-downloads flag for parallel layer downloads #716
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
Add --max-concurrent-downloads flag for parallel layer downloads #716
Conversation
c843892 to
cc15745
Compare
cc15745 to
26ebe63
Compare
Implements concurrent layer downloads to improve image pull performance by fetching multiple layers simultaneously instead of sequentially.
26ebe63 to
53e6c45
Compare
|
@dcantah anything else needed to merge this? |
|
@sbhavani Yes. We need a tag of Containerization that has the changes. I'm making some changes over there but should have a tag out within the next day or so and then we can bump to this. We should not have our dependency on Containerization be to a branch, and especially not main 😄 |
jglogan
left a comment
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.
@sbhavani Just a couple of nits if you still have time to move this forward. Thank you for contributing!
no problem! I'll take a look and make the changes |
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.
Thank you for the contribution 👍
The default value 3 seems reasonable.
e02e2ff to
21ac59f
Compare
dkovba
left a comment
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.
Please run make fmt to pass the PR checks.
Sources/ContainerClient/Flags.swift
Outdated
| @Option(name: .long, help: ArgumentHelp("Progress type (format: none|ansi)", valueName: "type")) | ||
| public var progress: ProgressType = .ansi | ||
|
|
||
| @Option(name: .long, help: "Maximum number of concurrent layer downloads (default: 3)") |
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.
@adityaramani Should we use the word "layer" or "blob" here?
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.
Use just "concurrent downloads"
dkovba
left a comment
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.
Please fix merge conflicts.
Resolved conflicts in: - Package.resolved: Updated to containerization 0.16.0 and new dependency hashes - ClientImage.swift: Preserved maxConcurrentDownloads parameter in fetch() method while adding new calculateDiskUsage() method from upstream - TestCLIImages.swift: Kept both maxConcurrentDownloads tests and new testImageSaveAndLoadStdinStdout test 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
dkovba
left a comment
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.
👍
Removed duplicate declaration of set(key:value:) with Int64 parameter that was causing build failure. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Sources/Services/ContainerImagesService/Client/ImageServiceXPCKeys.swift
Outdated
Show resolved
Hide resolved
jglogan
left a comment
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.
@sbhavani looks good, just a couple final nits related to messages...
| reference: String, platform: Platform? = nil, scheme: RequestScheme = .auto, progressUpdate: ProgressUpdateHandler? = nil, maxConcurrentDownloads: Int = 3 | ||
| ) async throws -> ClientImage { | ||
| guard maxConcurrentDownloads > 0 else { | ||
| throw ContainerizationError(.invalidArgument, message: "--max-concurrent-downloads must be greater than 0, got \(maxConcurrentDownloads)") |
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.
We shouldn't refer to command line arguments inside the client.
Should read "maximum number of concurrent downloads must be..."
Sources/ContainerClient/Flags.swift
Outdated
| @Option(name: .long, help: ArgumentHelp("Progress type (format: none|ansi)", valueName: "type")) | ||
| public var progress: ProgressType = .ansi | ||
|
|
||
| @Option(name: .long, help: "Maximum number of concurrent layer downloads (default: 3)") |
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.
Use just "concurrent downloads"
|
|
||
| #expect(status != 0, "Expected command to fail with maxConcurrentDownloads=0") | ||
| #expect( | ||
| error.contains("--max-concurrent-downloads must be greater than 0"), |
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.
fix to match the change
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.
made the update
Adds
--max-concurrent-downloadsflag tocontainer image pullfor configurable concurrent layer downloads.Fixes #715
Depends on apple/containerization#311
Usage:
Changes:
Performance: ~1.2-1.3x faster pulls for multi-layer images with higher concurrency
Tests: Included standalone tests verify concurrency behavior and parameter flow