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

Multiple copies of image layers maintained in memory during image pull #66

Open
anakrish opened this issue Oct 24, 2022 · 2 comments
Open

Comments

@anakrish
Copy link
Contributor

Currently during an image pull, multiple copies of each layer are maintained in memory before it is written out (possibly to secure storage):

  1. Each layer's blob is first pulled into an in memory vector. https://github.com/confidential-containers/image-rs/blob/c98c4916cbe8d2c4f8933b343d20b7fdb338f50e/src/pull.rs#L91-L95
  2. If the blob is encrypted, then it is decrypted to another in-memory vector. https://github.com/confidential-containers/image-rs/blob/c98c4916cbe8d2c4f8933b343d20b7fdb338f50e/src/pull.rs#L125-L127
  3. Then if the layer is compressed, it is decompressed to another in memory vector. https://github.com/confidential-containers/image-rs/blob/c98c4916cbe8d2c4f8933b343d20b7fdb338f50e/src/pull.rs#L166-L168
  4. The out vector which contains the layer's blob processed via the above steps is finally unpacked to destination folder: https://github.com/confidential-containers/image-rs/blob/c98c4916cbe8d2c4f8933b343d20b7fdb338f50e/src/pull.rs#L198

Pulling docker.io/library/python:latest using an image-rs test program on a linux machine shows the following memory consumption under heaptrack

peak heap memory consumption:
1.5GB after 11.733s
peak RSS (including heaptrack overhead):
888.8MB
total memory leaked:
50.9MB (10.6kB suppressed)

Given a kata-VM's default memory configuration of 2GB, 1.5GB memory consumption during image pull may cause slow performance and possibly OOM.

@anakrish
Copy link
Contributor Author

#24 reduces memory usage while pulling encrypted images.

@dcmiddle
Copy link
Member

Hi @anakrish Is this resolved by #96 ?
(similar comment in #67 )

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 a pull request may close this issue.

2 participants