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

overlay: Diffsize: avoid naive diff #1688

Merged
merged 1 commit into from Aug 14, 2023

Conversation

vrothberg
Copy link
Member

Computing the diff size for the rootful overlay storage driver used the naive diff. The reasoning was that we have made use of rootful copy-up. The downside is a mind-blowing performance penalty in comparison to the rootless case.

Hence, drop the naive diff and only compute the size of the directory which is absolutely sufficient for the motivating use case of podman-system-df. This drops the execution of system-df from 19.3s to 0.11s listing 5 containers and 1 image.

Fixes: github.com/containers/podman/issues/19467

Computing the diff size for the rootful overlay storage driver used the
naive diff.  The reasoning was that we have made use of rootful copy-up.
The downside is a mind-blowing performance penalty in comparison to the
rootless case.

Hence, drop the naive diff and only compute the size of the directory
which is absolutely sufficient for the motivating use case of
podman-system-df.  This drops the execution of system-df from 19.3s to
0.11s listing 5 containers and 1 image.

Fixes: github.com/containers/podman/issues/19467
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
@vrothberg
Copy link
Member Author

@giuseppe @rhatdan PTAL

Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

LGTM

@rhatdan
Copy link
Member

rhatdan commented Aug 14, 2023

LGTM

@rhatdan rhatdan merged commit ceef178 into containers:main Aug 14, 2023
18 checks passed
@rhatdan
Copy link
Member

rhatdan commented Aug 14, 2023

@giuseppe @nalind I merged, but would like to have you comment on this

@vrothberg vrothberg deleted the fix-podman-19467 branch August 14, 2023 16:01
@giuseppe
Copy link
Member

that is the patch I've suggested in containers/podman#19467 (comment) so I am fine with this approach

@@ -2162,10 +2162,6 @@ func (d *Driver) getLowerDiffPaths(id string) ([]string, error) {
// and its parent and returns the size in bytes of the changes
// relative to its base filesystem directory.
func (d *Driver) DiffSize(id string, idMappings *idtools.IDMappings, parent string, parentMappings *idtools.IDMappings, mountLabel string) (size int64, err error) {
if d.options.mountProgram == "" && (d.useNaiveDiff() || !d.isParent(id, parent)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

A random drive-by: Is it really correct to drop the special handling of !d.isParent?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks!

I think it doesn't matter for the current callers but we probably should do a naive diff if it's not the parent.
@giuseppe WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

yes, I also think we should do the naive diff in this case.

Thanks @mtrmac for spotting it

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

Successfully merging this pull request may close these issues.

None yet

5 participants