CRI: improve image pulling performance#6702
Merged
dmcgowan merged 1 commit intocontainerd:mainfrom Apr 6, 2022
Merged
Conversation
|
Build succeeded.
|
bc264a8 to
83a30dc
Compare
|
Build succeeded.
|
AkihiroSuda
reviewed
Mar 19, 2022
AkihiroSuda
reviewed
Mar 19, 2022
AkihiroSuda
reviewed
Mar 19, 2022
AkihiroSuda
reviewed
Mar 19, 2022
affc373 to
47925ba
Compare
|
Build succeeded.
|
Member
Author
|
@AkihiroSuda Updated. PTAL |
dcantah
reviewed
Mar 22, 2022
47925ba to
efb5dad
Compare
cpuguy83
reviewed
Mar 22, 2022
dcantah
reviewed
Mar 22, 2022
efb5dad to
07e8c86
Compare
|
Build succeeded.
|
kzys
reviewed
Mar 24, 2022
07e8c86 to
ad75b27
Compare
kzys
approved these changes
Apr 5, 2022
|
Build succeeded.
|
Member
Author
|
CI is green! |
dmcgowan
approved these changes
Apr 6, 2022
This was referenced Apr 15, 2022
dewjam
added a commit
to dewjam/containerd
that referenced
this pull request
Apr 22, 2022
dewjam
added a commit
to dewjam/containerd
that referenced
this pull request
Apr 22, 2022
Signed-off-by: Jim DeWaard <dewaard@amazon.com>
smira
added a commit
to smira/talos
that referenced
this pull request
Apr 26, 2022
This includes a fix for image pull slowness from containerd/containerd#6702. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
smira
added a commit
to smira/talos
that referenced
this pull request
Apr 26, 2022
This includes a fix for image pull slowness from containerd/containerd#6702. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
smira
added a commit
to smira/talos
that referenced
this pull request
Apr 28, 2022
This includes a fix for image pull slowness from containerd/containerd#6702. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com> (cherry picked from commit 1973095)
7 tasks
smira
added a commit
to smira/talos
that referenced
this pull request
May 4, 2022
This includes a fix for image pull slowness from containerd/containerd#6702. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com> (cherry picked from commit 1973095)
This was referenced Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background:
With current design, the content backend uses key-lock for long-lived
write transaction. If the content reference has been marked for write
transaction, the other requestes on the same reference will fail fast with
unavailable error. Since the metadata plugin is based on boltbd which
only supports single-writer, the content backend can't block or handle
the request too long. It requires the client to handle retry by itself,
like OpenWriter - backoff retry helper. But the maximum retry interval
can be up to 2 seconds. If there are several concurrent requestes fo the
same image, the waiters maybe wakeup at the same time and there is only
one waiter can continue. A lot of waiters will get into sleep and we will
take long time to finish all the pulling jobs and be worse if the image
has many more layers, which mentioned in issue #4937.
After fetching, containerd.Pull API allows several hanlers to commit
same ChainID snapshotter but only one can be done successfully. Since
unpack tar.gz is time-consuming job, it can impact the performance on
unpacking for same ChainID snapshotter in parallel.
For instance, the Request 2 doesn't need to prepare and commit, it
should just wait for Request 1 finish, which mentioned in pull
request #6318.
Both content backoff retry and unnecessary unpack impacts the performance.
Solution:
Introduced the duplicate suppression in fetch and unpack context. The
deplicate suppression uses key-mutex and single-waiter-notify to support
singleflight. The caller can use the duplicate suppression in different
PullImage handlers so that we can avoid unnecessary unpack and spin-lock
in OpenWriter.
Test Result:
Before enhancement:
With this enhancement:
Test Script:
localhost:5000/{redis|golang}:latest is equal to
docker.io/library/{redis|golang}:latest. The image is hold in local registry
service by
docker run -d -p 5000:5000 --name registry registry:2.Fixes: #4937
Close: #4985
Close: #6318
Signed-off-by: Wei Fu fuweid89@gmail.com