Skip to content
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

Download chunks concurrently when in background download mode #231

Open
1 task done
gorbak25 opened this issue Jun 16, 2023 · 3 comments
Open
1 task done

Download chunks concurrently when in background download mode #231

gorbak25 opened this issue Jun 16, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@gorbak25
Copy link

gorbak25 commented Jun 16, 2023

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. 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?

  • Yes, I am willing to implement it.
@gorbak25 gorbak25 added the enhancement New feature or request label Jun 16, 2023
@gorbak25 gorbak25 changed the title Support lazy pulling on high bandwidth high latency connections by pipelining requests to OCI registries Download chunks concurrently when in background download mode Jun 16, 2023
@shuaichang
Copy link

@gorbak25 glad to meet you! We (another overlybd user) also trying to saturate our networking by pre-pull all the blobs as fast as we can. I think it's doable from the client side (ctr rpull --download-blobs), current download is not fast, but we internally is experimenting replacing the containerd client.Pull with our own fast puller.

There are other benefits for repull from client side is it give better observability and we can behave differently in the pull failed due to networking or any other failure so that networking availability will not affect application runtime stability.

containerd/accelerated-container-image#195

@gorbak25
Copy link
Author

@shuaichang In my case I'm not using containerd or the overlaybd containerd snapshoter, I've integrated directly with overlaybd-tcmu which is used by the overlaybd containerd snapshotter and run qemu VM's using it. By looking at the code I think this is a fairly easy fix in overlaybd for background download to be as performant as pre downloaded blobs. Previously I've used skopeo to download all blobs ahead of time and recently implemented optional lazy pulling. I have a good setup to compare the difference after I make a PR.

@lihuiba
Copy link

lihuiba commented Jun 19, 2023

The current implementation tries to avoid downloading too fast in background, in the hope that it would not influence foreground work.

Indeed the speed may be too slow for networks with high bandwidth-delay product. Welcome to make a PR to improve this case!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants