PDA

View Full Version : Limit user CPU usage



kb00heda
December 12th, 2005, 08:53 AM
Hi,

Maybe this is not the appropriate area for this post... however, I could not find a better one. So, here goes:

I would like to limit the CPU usage for a user, say that he/she should be allowed to use no more than 50 percent of the CPU resources. I recognized this to be possible on a CPU time basis via /etc/security/limits.conf, but this is somewhat different. Alternatively, is it possible to limit the CPU usage for a single process, e.g., to have it fixed at 50 percent?

Regards,
David

towsonu2003
January 15th, 2006, 02:09 AM
anything new on this? I'm interested how to that as well (sick of clamscan eating 101% cpu and driving heat up 10-15 degrees celsius (from an average of 45 to 62) over 2-3 minutes)

also, this need to be moved to a technical forum...

curtis
January 15th, 2006, 04:06 AM
ulimit may help, I am not sure though.

BSDFreak
January 15th, 2006, 05:09 AM
ulimit may help, I am not sure though.

No, the only thing you can set with ulimit is the cpu time before the process is aborted.

Only thing that comes to mind is nice and renice, to set priority, which will work just fine if it's slowdown on other processes you are worried about.

Mr_Grieves
January 15th, 2006, 05:48 AM
I don't know.. so I'll just use my huge imagniation.


Fread not! It's IMAGNIARY BOY!

-Create a virual root for the user, in this virtual root, replace all commands with scripts that 'nice' each and every command!

BSDFreak
January 15th, 2006, 05:49 AM
I don't know.. so I'll just use my huge imagniation.

man renice. It's not neccessary to do it per process, it can be done per user if you don't want it per process. ;)

Mr_Grieves
January 15th, 2006, 05:53 AM
man renice. It's not neccessary to do it per process, it can be done per user if you don't want it per process. ;)
AHA!



In this episode! IMAGINARY BOY! encounters his ARCH enemy - BSDFreak BOY!

<WHAM!>
<POW!>
<CRASH!>

What about this BSDFreak BOY?

-You create a VMWare enviorment in where this new user must reside! and.. YOU NICE THE VWWare PROCESS!!


I'm sorry kb00heda for the offtopic. I'm soon off to bed. I promise.

BSDFreak
January 15th, 2006, 06:00 AM
AHA!



I'm sorry kb00heda for the offtopic. I'm soon off to bed. I promise.

Um, why not just use renice -u? Or if you are going to use a VM, use Qemu, it's FOSS. ;)

Watch out for the superbaseballbatboy though (old game reference, bonus points if you know where it's from).

sportfreak2020
December 8th, 2009, 04:22 PM
i know this is an old thread, but i use cpulimit across all our dev servers to limit every thing running on them..
there is a certain script that can be utilized, ie., like a white list and black list...

there is a very nice howto about this one!!

http://ubuntuforums.org/showthread.php?t=992706

hope it helps someone!!!! :D