Skip to content

registry remotecache: push cache blobs in parallel - #6455

Merged
tonistiigi merged 1 commit into
moby:masterfrom
amrmahdi:amrmahdi/parallel-cache-push
Jan 14, 2026
Merged

tonistiigi merged 1 commit into
moby:masterfrom
amrmahdi:amrmahdi/parallel-cache-push

Conversation

@amrmahdi

Copy link
Copy Markdown

Registry cache blob pushing was sequential, copying one layer at a time. This uses images.Dispatch to push all cache layer blobs in parallel, similar to how image export already handles layer pushing.

The blobs are collected upfront, pushed concurrently, then added to the cache manifest in order after all pushes complete.

Comment thread cache/remotecache/export.go Outdated
Comment thread cache/remotecache/export.go Outdated
Registry cache blob pushing was sequential, copying one layer at a time. This
uses images.Dispatch to push all cache layer blobs in parallel, similar
to how image export already handles layer pushing.

The blobs are collected upfront, pushed concurrently, then
added to the cache manifest in order after all pushes complete.

Signed-off-by: Amr Mahdi <amrmahdi@meta.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR optimizes registry cache export by parallelizing cache blob uploads. Previously, cache layer blobs were pushed sequentially, which could be slow for large builds. The PR now uses images.Dispatch to push all cache layer blobs in parallel with a concurrency limit of 4 (matching the existing default for registry connections).

Changes:

  • Refactored util/resolver/limited/group.go to expose DefaultMaxConcurrency as a public variable
  • Modified cache/remotecache/export.go to collect layer descriptors upfront, push them in parallel using images.Dispatch, then add them to the cache manifest in order

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
util/resolver/limited/group.go Exposed DefaultMaxConcurrency as a public int64 variable (value 4) to allow reuse across packages
cache/remotecache/export.go Refactored Finalize method to push cache layer blobs in parallel using images.Dispatch with semaphore-based concurrency control, while preserving blob order in the final manifest

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cache/remotecache/export.go
Comment thread util/resolver/limited/group.go
@tonistiigi
tonistiigi merged commit 7820491 into moby:master Jan 14, 2026
195 checks passed
@amrmahdi
amrmahdi deleted the amrmahdi/parallel-cache-push branch January 14, 2026 21:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants