containerd icon indicating copy to clipboard operation
containerd copied to clipboard

converter: improve concurrency performance

Open imeoer opened this issue 3 years ago • 1 comments

converter: introduce converter.New method

With converter.New and converter.NewDefault, users can specify WithConvertHooks or other any option func wrappers, it's provides better extensibility.

converter: improve concurrency performance

Introduce converter.WithSingleflight for converter.New and converter.NewDefault, it uses singleflight to make sure that only one conversion execution is in-flight for a given child descriptor at a time.

This change can improve converter performance to avoid getting lock on writing to the content store, in particular, in the use case of implementing an image conversion service based on the converter (e.g. accled).

The performance of this change in the image conversion test case for a concurrent number of 20 is compared as follows:

Tested with local registry (localhost:5000/busybox:latest):

Before: 20s+ with part errors. After: 0.283s

Signed-off-by: Yan Song [email protected]

imeoer avatar Jul 12 '22 08:07 imeoer

Hi @imeoer. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

k8s-ci-robot avatar Jul 12 '22 08:07 k8s-ci-robot

Need to consider if the PR is necessary.

imeoer avatar Mar 15 '23 06:03 imeoer