Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to limit a user on my system to only be able to use one core of my system.

After searching, I found this, but I can't figure out how to use it.

I would also like to limit the use of that core to a specific percentage to prevent abuse.

share|improve this question
    
For what distribution? What have you tried so far? –  Michael Hampton Jun 9 at 15:07
    
Ubuntu 14.04 server. I tried installing it and messing a bit around, but I didn't know where to start. The man page didn't help much. –  Jacob Pedersen Jun 9 at 15:14

1 Answer 1

up vote 1 down vote accepted

The approach of limiting cores/cpu usage is most likely not what you want. Is it that you have a user who likes to run multicore/intensive tasks, and it ends up slowing down the whole server? The solution is to "nice" that user automatically.

In your /etc/security/limits.conf, you would want to add an entry for your abusive user (-19 to 19, with 19 being the lowest priority):

username    -       priority        19

Basically this means setting that user to run at a lower priority. If nobody else is running processes, then this user can consume the extra available CPU (idle CPU is wasted CPU). But if anything else is running, this user's processes will yield CPU. I've heard that servers are designed to run optimally at 100% cpu, and that you can't bank unused CPU cycles to use later.

Background: I have a Linux server that runs at 100% CPU 24x7 on all cores. It simultaneously runs computation intensive financial analysis software, a MySQL DB, a Tomcat instance, and Apache/PHP. The financial software will eat as much CPU and cores they can get, so I have them at priority 19. I want my Tomcat and Apache/PHP servers to be responsive, so I set them at -2 or -3. The web pages come up just as fast with or without the financial software running, thanks to properly managing priorities.

share|improve this answer
    
Ah. This is probably a better approach for me :) Thanks! –  Jacob Pedersen Jun 9 at 16:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.