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

Trim images in Node objects to reduce memory footprint #6351

Merged
merged 1 commit into from
May 22, 2024

Conversation

tnqn
Copy link
Member

@tnqn tnqn commented May 21, 2024

The images field is of no use to Antrea while it could be a long list and take quite some space as antrea-controller and all antrea-agent instances cache all Nodes in the cluster.

Trimming images can release nearly 10m memory from each Antrea process in a cluster of 1k Nodes, saving 10G memory in total.

The images field is of no use to Antrea while it could be a long list
and take quite some space as antrea-controller and all antrea-agent
instances cache all Nodes in the cluster.

Trimming images can release nearly 10m memory from each Antrea process
in a cluster of 1k Nodes, saving 10G memory in total.

Signed-off-by: Quan Tian <[email protected]>
@tnqn tnqn added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label May 21, 2024
@tnqn tnqn requested a review from antoninbas May 21, 2024 11:43
@tnqn
Copy link
Member Author

tnqn commented May 21, 2024

/test-all

Copy link
Contributor

@antoninbas antoninbas left a comment

Choose a reason for hiding this comment

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

LGTM

if !ok {
return obj, nil
}
node.Status.Images = nil
Copy link
Contributor

Choose a reason for hiding this comment

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

is node.Status.NodeInfo safe to remove as well?
is it insignificant compared to node.Status.Images?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's safe to remove it. However, the field is not a pointer but a struct containing 10 strings, while each string is not too long. To trim them, the simplest code is to override it with a new struct, which could increase heap usage 160 bytes per object temporarily, whille overriding one field per line seems not very worth as each field is not long: the total data size in a typical nodeInfo is about 200 bytes.

  nodeInfo:
    architecture: amd64
    bootID: 56ae4e38-a8b1-4657-8b8a-86a75623926e
    containerRuntimeVersion: containerd://1.7.15
    kernelVersion: 5.4.0-169-generic
    kubeProxyVersion: v1.30.0
    kubeletVersion: v1.30.0
    machineID: d61012698a3649178b7f74d6f57fc965
    operatingSystem: linux
    osImage: Debian GNU/Linux 12 (bookworm)
    systemUUID: d43097b6-a686-420f-b033-fd5c15392e4d

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point, thanks for the detailed answer

@tnqn tnqn merged commit 06d6cc7 into antrea-io:main May 22, 2024
51 of 55 checks passed
@tnqn tnqn deleted the trim-nodes branch May 22, 2024 03:37
@luolanzone luolanzone added this to the Antrea v2.1 release milestone Jul 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants