common icon indicating copy to clipboard operation
common copied to clipboard

[optimize] add a new parameter to LoadOptions

Open kakaZhou719 opened this issue 2 years ago • 8 comments

hi containers team,

when i learning our code, I found that If i knew the format of the tar file in advance , the program wouldn't need to guess the format, which will save a lot of time.

so , should we add a new parameter to indicate the format of load package on LoadOptions ?

FYI: https://github.com/containers/common/blob/28ebcc64cf9af714badd8abd5521ed49545642c0/libimage/load.go#L33

kakaZhou719 avatar Mar 22 '23 10:03 kakaZhou719

Hi @kakaZhou719,

Thanks for reaching out and offering help, very much appreciated!

I found that If i knew the format of the tar file in advance , the program wouldn't need to guess the format, which will save a lot of time.

That sounds like a nice improvement assuming the user knows exactly the format of the archive.

Before starting, I want to ask @mtrmac and @rhatdan what they think about your proposal.

vrothberg avatar Mar 22 '23 10:03 vrothberg

Fine with me. But I would like to hear from @mtrmac

rhatdan avatar Mar 22 '23 13:03 rhatdan

If this is for a new caller, I think a set of separate functions (Runtime.LoadDockerArchive etc.) would be simpler.

If this is for the primary podman load $path code path, yes, an option probably makes sense — and it would be great to update as many callers as possible to use that option; heuristically guessing among four possibly quite expensive readers is very inefficient and historically resulted in bad error messages (which we have, sort of, fixed by just listing all of the error messages…)

mtrmac avatar Mar 22 '23 16:03 mtrmac

@rhatdan @mtrmac @vrothberg ,thanks for your kind reply.

BTW, could we support to set temporary directory when loading?

the reason is that some image is very large, and require at least three times free disk to load. I see that current default temporary directory is the /var/tmp/ directory. If we could set the work temporary directory, we can separate it from the system disk which will avoid load failure.

kakaZhou719 avatar Mar 24 '23 02:03 kakaZhou719

BTW, could we support to set temporary directory when loading?

That’s configurable in c/image via BigFilesTemporaryDir, and c/common/libimage seems to read containers.conf for that at least in some places, so that would be the setting to tweak. (I didn’t check if LoadDockerArchive applies this setting; if not, that should be added.)

mtrmac avatar Mar 24 '23 19:03 mtrmac

Yes setting this in containers.conf, or setting the TMPDIR environment variable allow you to customize this.

rhatdan avatar Mar 27 '23 15:03 rhatdan

@rhatdan @mtrmac @vrothberg , do we have a plan to support a set of separate functions (Runtime.LoadDockerArchive) ?

kakaZhou719 avatar Mar 28 '23 02:03 kakaZhou719

@rhatdan @mtrmac @vrothberg , do we have a plan to support a set of separate functions (Runtime.LoadDockerArchive) ?

I would rather add a Format string field to the LoadOptions. Otherwise, all callers would have the same dispatch table (switch Format case ... case ... case ...).

vrothberg avatar Mar 28 '23 08:03 vrothberg