LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-30-2009, 09:04 AM   #1
jamespayne79
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Rep: Reputation: 0
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.
 
Old 03-31-2009, 01:55 AM   #2
vlademir
Member
 
Registered: Jan 2009
Location: The Netherlands
Distribution: Centos,Ubuntu,Mandriva,Suse11.1
Posts: 86

Rep: Reputation: 17
Smile

Quote:
Originally Posted by jamespayne79 View Post
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.
Hi,

See this threat :

http://www.linuxquestions.org/questi...-usage-617928/
 
Old 04-05-2009, 04:07 AM   #3
jamespayne79
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Question

Quote:
Originally Posted by vlademir View Post
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?
 
Old 04-05-2009, 05:12 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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.
 
Old 04-05-2009, 05:28 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,140

Rep: Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123Reputation: 4123
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.
 
Old 04-06-2009, 10:28 AM   #6
jamespayne79
LQ Newbie
 
Registered: Sep 2008
Posts: 4

Original Poster
Rep: Reputation: 0
Thumbs up 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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to limit the users CPU usage ? maginotjr Linux - Server 3 02-04-2008 08:00 PM
need a command to limit cpu usage ra2000 Linux - General 2 12-03-2006 09:02 PM
Limit CPU usage slantoflight Linux - General 5 02-23-2006 03:37 AM
how to determine cpu usage, memory usage, I/O usage by a particular user logged on li rags2k Programming 4 08-21-2004 04:45 AM
limit cpu usage by mysql eduac Linux - Software 3 06-08-2004 05:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 12:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration