Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Restricting process CPU usage using nice, cpulimit, and cgroups (scoutapp.com)
29 points by itsderek23 on Nov 4, 2014 | hide | past | favorite | 7 comments


Isn't writing to the cgroupfs yourself no longer recommended? Instead you should send requests to your system's privileged cgroup writer (whether it be cgmanager, systemd or something else)? Or am I wrong?

That said, I'm pretty sure that niceness is mostly just a suggestion to the kernel. The scheduler's heuristics have the final say.


For newer kernels the cgroupfs is deprecated in favour of a single writer which will probably be systemd on most systems, but the author's examples are on RHEL/CENTOS 6, which has the older model.


>This is because when a single process is running, it uses as much CPU as necessary, regardless of which cgroup it is placed in. The CPU limitation only comes into effect when two or more processes compete for CPU resources.

So doesn't this mean cgroups can't be used in the same way as cpulimit? cpulimit lets me limit the total max CPU usage of a process regardless of the rest of the system. The article makes it look like cgroups only allows setting the _partitioning of CPU_, not _total allowed CPU_.

Edit: Looks like the way to do it is to use cpu.cfs_period_us and cpu.cfs_quota_us instead of cpu.shares

https://access.redhat.com/documentation/en-US/Red_Hat_Enterp...


Yes, they can. cgroups can set absolute or share-based limits.


I've used cpulimit to force slow down flash games but it causes them to crash randomly.

I'm hoping cgroups can do better.


I think 'nice' and 'cpulimit' should change names


To what? (And why?)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: