containerd / containerd/overlaybd

Download chunks concurrently when in background download mode

Open
#231 3 comments 1 reaction 0 assignees View on GitHub
enhancement
Dominant language
C++
Stars
410
Forks
85
Avg merge
2d 14h
Merged PRs (30d)
10

Description

### What is the version of your Overlaybd

_No response_

### What would you like to be added?

I would like overlaybd to download chunks concurrently when in background download mode, instead of waiting for one chunk to download before starting on the next.

### Why is this needed for Overlaybd?

OverlayBD lazy pulling works amazingly if the latency between the backing OCI registry and `overlaybd-tcmu` is less than 2ms. Unfortunately, this isn't the case if the latency is high, for example 200-300ms when talking to quay.io. Downloading each 256Kb chunk is near instant, but it takes 200ms for a roundtrip to the registry, and containers boot slowly.

Increasing the refillSize to 10 Mb helps. Lazy pulling from quay.io works better, but still the link is nowhere near saturated, and boot times are high. Probably raising the chunk size to 100 Mb would help, but at such a high chunk size all benefits of lazy pulling are negated.

When background download is enabled the layer download speed of overlaybd should be indistinguishable from just pulling the layers ahead of time using a tool like skopeo or crane. Currently, that's not the case as [downloading chunks is synchronous](https://github.com/containerd/overlaybd/blob/716d807f8ce0698ab846c97aa7435cc2ed715310/src/bk_download.cpp#LL224C13-L224C17). Overlaybd waits for one chunk to finish downloading before starting on the next. I want to solve this by having a thread pool downloading chunks concurrently, similar to prefetch.

### Are you willing to submit PRs to contribute to this feature?

- [x] Yes, I am willing to implement it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.