DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
We have a Debian server that are used for computation and shared by several users. Sometimes, a single user may have ill-written script that will ocupy all the CPU time. That makes the server unaccessible for other users. In that case, even the administrator cannot login to the system and kill the trouble-making process.
Just wondering if there's any software or daemon that can restrict the CPU usage of a user or group, just like what "quota" did for disk space. The buttom line, total user CPU usage should be less than some threshold, e.g. 80%. So the system administrator always have a chance to clean up the mess.
We have a Debian server that are used for computation and shared by several users. Sometimes, a single user may have ill-written script that will ocupy all the CPU time. That makes the server unaccessible for other users. In that case, even the administrator cannot login to the system and kill the trouble-making process.
Just wondering if there's any software or daemon that can restrict the CPU usage of a user or group, just like what "quota" did for disk space. The buttom line, total user CPU usage should be less than some threshold, e.g. 80%. So the system administrator always have a chance to clean up the mess.
Thanks for the reply. I tried limits.conf, but it doesn't seem to be working. I added a group called "students" and put all users into that group. Then limited 30 processes for "students" members. However, when I do "ulimit -a", it shows the user still can have thousands of processes.
Any ideas? Does it has something to do with the SMP kernel we use?
Check your PAM configurations and see if pam_limits is used. Also check the line that includes pam_limits.so and see if another config file is used.
You could also invoke ulimit in /etc/profile (or /etc/profile.local if that is what is used). Also be sure to scan through the logs. Perhaps try to exceed the limits yourself using your own user account while monitoring the logs.
Have a look at cpulimit - it's a bit hard to manage for lots of processes; especially of they are short-lived, but works as advertised.
For multi-CPU configs I use cgroups (nee cpusets) and confine groups of processes/users to a subset of total CPUs - documented in the source tree. Might work for you if you can limit groups of users - the granularity isn't great though.
Thanks jschiwal and syg00 for you important and useful suggestions. The limits work great now! And I will definitely check the "cgroups", sounds like what I am looking for.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.