LukeShortCloud / rootpages

Root Pages is a collection of easy-to-reference tutorials and guides primarily for Linux and other UNIX-like systems.
Other
56 stars 6 forks source link

[graphics][gaming] Limit CPU utilization of Steam downloads #1025

Open LukeShortCloud opened 11 months ago

LukeShortCloud commented 11 months ago

Test using renice +10 <STEAM_PID> (set Steam priority to 50% lower than other processes) and cpulimit --pid <STEAM_PID> --limit 50 (set Steam to only use a single core at 50% CPU utilization) to see what works better. The goal is to have Steam running in the background doing updates without affecting gameplay.

LukeShortCloud commented 9 months ago

I know I documented this somewhere but I can't recall where. renice (CPU priority) and ionice (IO priority) require the CFQ CPU scheduler to work.

In order of most effective to least:

  1. cpulimit
  2. ionice
  3. renice

Use a combination for best results.

LukeShortCloud commented 9 months ago

This is untested but limiting RAM may also help. Steam downloads are more CPU and I/O intensive from my own personal observations.

Example of limiting it to 1 GB:

$ prlimit --pid <STEAM_PID> --as=1024000000

https://askubuntu.com/questions/1367612/how-can-i-limit-the-cpu-and-ram-usage-for-a-process https://unix.stackexchange.com/questions/44985/limit-memory-usage-for-a-single-linux-process

LukeShortCloud commented 9 months ago

""" A niceness should not be confused with a scheduling priority, which lets applications determine the order in which threads are scheduled to run. Unlike a priority, a niceness is merely advice to the scheduler, which the scheduler is free to ignore. Also, as a point of terminology, POSIX defines the behavior of nice in terms of a nice value, which is the non-negative difference between a niceness and the minimum niceness. Though nice conforms to POSIX, its documentation and diagnostics use the term “niceness” for compatibility with historical practice. """

https://www.gnu.org/software/coreutils/manual/html_node/nice-invocation.html