Skip to content

Instantly share code, notes, and snippets.

@abraithwaite
Last active May 8, 2024 08:43
Show Gist options
  • Save abraithwaite/1d78a946f90be478faedb5ca4db6d62e to your computer and use it in GitHub Desktop.
Save abraithwaite/1d78a946f90be478faedb5ca4db6d62e to your computer and use it in GitHub Desktop.
Zoom in Systemd Cgroups on Linux. Change the max allocations to fit your workstation.
#!/usr/bin/bash -xe
cat <<EOF > "${HOME}/.config/systemd/user/zoom.slice"
[Slice]
AllowedCPUs=0-4
MemoryHigh=6G
EOF
cat /usr/share/applications/Zoom.desktop | sed -E 's#^(Exec=).*$#Exec=/usr/bin/systemd-run --user --slice=zoom.slice /opt/zoom/ZoomLauncher#' > "${HOME}/.local/share/applications/Zoom.desktop"
update-desktop-database ~/.local/share/applications
@desrod
Copy link

desrod commented Sep 5, 2023

I stumbled across this in a search to solve why Zoom consumes 150% of my 12 CPU cores when running, and it looked like it would solve the problem by constraining the memory and CPUs.

Unfortunately, this does not work if your Zoom session requires you to log in, or uses SSO or is tied to a company domain, which many to most would be (yes, even when passing %U at the end, as in the previous reply above this one).

Once that happens, you're stuck in an endless loop of systemd running the Zoom client unauthorized, prompting for auth using the browser, which then launches a new instance of Zoom (unauthorized), and round-and-round we go, never actually saving the login credentials or passing them to the Zoom client.

I'm back on the hunt for other solutions...

@maxxu05
Copy link

maxxu05 commented Dec 13, 2023

@desrod hey I think @brightonanc and I found a workaround for this. If you replace the exec line in ${HOME}/.local/share/applications/Zoom.desktop with

Exec=systemd-run --scope -p MemoryMax=4G -p MemoryHigh=2G -p MemorySwapMax=0 -p CPUQuota=25%% --user -- /usr/bin/zoom %U

Then it should work with SSO and limit RAM and CPU cores.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment