rancher-sandbox / rancher-desktop

Container Management and Kubernetes on the Desktop
https://rancherdesktop.io
Apache License 2.0
5.72k stars 268 forks source link

High CPU usage on Apple with k3s, when Rancher is idle #7087

Open rsmogura opened 3 weeks ago

rsmogura commented 3 weeks ago

Actual Behavior

I observed high CPU usage - around 20%, when running Rancher on Apple, when the Kubernetes is enabled. I checked with QEmu and VZ, and both produces same results (QEmu even looks a bit more worse) - [1]

The processes in Lime VM do show report high CPU usage with top [2].

I suspect this can be related to different virtualisation stuff and most probably networking. When I will have time I will do some checks and experiments, however for now trying to download large ISO, causes spike in CPU.

Running below command

curl https://releases.ubuntu.com/24.04/ubuntu-24.04-desktop-amd64.iso -o - > /dev/null

causes CPU usage to be 20-30% in activity monitor, when k3s is disabled

As Rancher controls lime to some degree, opening issue here first.


[1] Activity from Activity Monitor for Rancher it was started few hours before taking this activity

VM Virtual Machine Service for limactl.ventura 17,7 (CPU) 39:47,97 (CPU Time)

[2] Top from sudo top form ~/.rd/bin/rdctl shell

  PID  PPID USER     STAT   VSZ %VSZ CPU %CPU COMMAND
 4403  4402 root     S    1265m  43%   1   0% /usr/bin/dockerd
 4425  4403 root     S    1241m  42%   7   0% containerd --config /var/run/docker/containerd/containerd.toml
 4280  4278 radek    S     7796   0%   2   0% sshd.pam: radek@pts/0
 4307  4281 radek    R     1720   0%   1   0% top
   16     2 root     IW       0   0%   4   0% [rcu_sched]

Steps to Reproduce

Run Rancher desktop on Apple Silicon with Kubernetes enabled (no QEMU, or Rosetta), check CPU usage in Activity Monitor

Result

CPU Usage around 20%

Expected Behavior

Cpu usage around 2% - best 0%

Additional Information

No response

Rancher Desktop Version

1.14.2

Rancher Desktop K8s Version

1.29.5 and other

Which container engine are you using?

moby (docker cli)

What operating system are you using?

macOS

Operating System / Build Version

14.5

What CPU architecture are you using?

arm64 (Apple Silicon)

Linux only: what package format did you use to install Rancher Desktop?

None

Windows User Only

No response

rsmogura commented 2 weeks ago

I think this is QEMU bug, and Apple VZ (which derives QEMU?) - I opened downstream ticket: https://github.com/rancher-sandbox/rancher-desktop/issues/7087