How to limit a user’s CPU resources in Linux Systems

When you use a server with other users, you might want to limit other users’ CPU resources for some specific aims.

Cgroup has lots of parameters we can use to control computer resources. For CPU resources, you can tune cpu.shares parameter to limit users’ CPU resources.

To be more precise, change directory to /sys/fs/cgroup/cpu/user and choose the user you want to control. And then, you will see cpu.shares parameter under the directory. You might want to read [1] for more details about how to tune it.

[1] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-cpu.html

Answered by harryxiyou.

Leave a Reply

Your email address will not be published. Required fields are marked *