0

I'm running a Chrome instance on a NAT VPS. Being a NAT VPS it has some restrictions such not not allowing a 15min average load greater than 1. However, just starting and going to a few webpages causes the load to increase > 2 killing the instance.

I read about limiting CPU usage online but most are limited to a single process, whereas Chrome spawns multiple process. I've tried using cpulimit but it doesn't help since it can only be used on a single PID.

Is there a way I can limit the CPU usage of the entire system as a whole? Or atleast any process started by the chrome executable?

Thanks.

PS: The chrome instance is being started and controlled using Selenium on Python.

DentFuse
  • 35
  • 5
  • 1
    cgroups might serve your purpose. – RonJohn Apr 11 '23 at 07:44
  • Yep, put the whole chromium invocation in a cgroup and limit that cgroup. There's many people that containerize chromium – in the end, flatpaks are exactly that – but I think in this case, a plain OCI container (as you can run with Docker or Podman) is the easiest. See Jessie Frazelle's [docker files for desktop applications](https://github.com/jessfraz/dockerfiles). – Marcus Müller Apr 11 '23 at 07:55
  • I looked at `cgroups`. Most guides show that they divide CPU time based on the cpu.shares value. For example, if 2 groups have 512 and 1024 shares, they will still be using the whole 100% of the CPU just 33% and 67% respectively. Also if a single process is run, it will be eating the whole. I'm trying to not use the whole CPU in order to keep my load average low. – DentFuse Apr 11 '23 at 10:05
  • `cpulimit` has an option `--include-children`. – meuh Apr 11 '23 at 11:52
  • @meuh Yea, I just tried that, but for some reason it completely killed the server. Last thing I saw was that the load average looked like increasing rapidly until they approached something like 5000 1500 300, don't remember the exact values. – DentFuse Apr 11 '23 at 11:59

0 Answers0