Skip to content

Add connection limit for thick daemon.#1510

Merged
bpickard22 merged 2 commits into
k8snetworkplumbingwg:masterfrom
hrntknr:limit_listener
May 29, 2026
Merged

Add connection limit for thick daemon.#1510
bpickard22 merged 2 commits into
k8snetworkplumbingwg:masterfrom
hrntknr:limit_listener

Conversation

@hrntknr

@hrntknr hrntknr commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the Connection Limit being considered below.

Related

Close: #1346

Background

When inspecting Multus itself using pprof, memory usage typically ranges from 50-60 MiB. However, since Multus launches additional CNIs, the total memory consumption of the entire container becomes the sum of all these components.
To run multus with strict memory limits, we essentially have to limit the number of parallel processes.

$ CG=$(sed -n 's/^0:://p' /proc/$(pgrep multus-daemon)/cgroup)
$ sh -c 'ps -o pid,ppid,pcpu,pmem,rss,vsz,comm,args --sort=-rss -p $(paste -sd, /sys/fs/cgroup'"$CG"'/cgroup.procs)'
    PID    PPID %CPU %MEM   RSS    VSZ COMMAND         COMMAND
1704573    6275 12.3  0.0 56180 1298756 cilium-cni     /opt/cni/bin/cilium-cni
1704707    6275 12.7  0.0 56036 1298756 cilium-cni     /opt/cni/bin/cilium-cni
1704848    6275 16.2  0.0 55692 1298500 cilium-cni     /opt/cni/bin/cilium-cni
1704911    6275 20.0  0.0 55584 1299268 cilium-cni     /opt/cni/bin/cilium-cni
1704443    6275 10.4  0.0 55476 1298756 cilium-cni     /opt/cni/bin/cilium-cni
1704846    6275 13.5  0.0 55364 1298500 cilium-cni     /opt/cni/bin/cilium-cni
1705061    6275 24.0  0.0 55324 1298756 cilium-cni     /opt/cni/bin/cilium-cni
1705067    6275 20.0  0.0 55076 1297732 cilium-cni     /opt/cni/bin/cilium-cni
1704908    6275 14.2  0.0 54716 1297540 cilium-cni     /opt/cni/bin/cilium-cni
1705087    6275 20.0  0.0 54560 1297732 cilium-cni     /opt/cni/bin/cilium-cni
1704572    6275 10.9  0.0 54496 1299268 cilium-cni     /opt/cni/bin/cilium-cni
1705098    6275 20.8  0.0 54480 1298244 cilium-cni     /opt/cni/bin/cilium-cni
1705065    6275 24.0  0.0 54448 1298244 cilium-cni     /opt/cni/bin/cilium-cni
1705097    6275 20.8  0.0 54064 1297732 cilium-cni     /opt/cni/bin/cilium-cni
1704910    6275 14.2  0.0 53924 1297220 cilium-cni     /opt/cni/bin/cilium-cni
1705359    6275 55.5  0.0 53920 1297988 cilium-cni     /opt/cni/bin/cilium-cni
   6275    4648  0.0  0.0 53684 1282624 multus-daemon  /usr/src/multus-cni/bin/multus-daemon
1705066    6275 20.0  0.0 52880 1296964 cilium-cni     /opt/cni/bin/cilium-cni

Therefore, the best solution would be to directly incorporate the patch previously proposed by @juliusmh.

Co-authored-by: Takanori Hirano <me@hrntknr.net>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a ConnectionLimit configuration option to the multus-daemon, utilizing golang.org/x/net/netutil.LimitListener to restrict simultaneous connections. It also adds an E2E test to verify this behavior. The review feedback suggests validating that the connection limit is greater than zero during startup, using an EXIT trap in the E2E test script to guarantee resource cleanup on failure, and replacing the EOL centos:8 image with a lightweight alpine:3 image in the test template.

Comment thread cmd/multus-daemon/main.go Outdated
Comment thread e2e/test-connection-limit.sh
Comment thread e2e/templates/many-pods.yml.j2
@bpickard22 bpickard22 merged commit db30741 into k8snetworkplumbingwg:master May 29, 2026
18 checks passed
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.

[OOMKilled] High memory consumption

4 participants