How to limit the CPU usage per user?
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. |
Quote:
See this threat : http://www.linuxquestions.org/questi...-usage-617928/ |
Quote:
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. |
That why they call people guru
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.
|
All times are GMT -5. The time now is 04:19 PM. |