I was just looking for some clarification about the niceness value of a process, or perhaps some advice if I'm going about this all wrong.
Say I have a couple dozen web server processes on a single machine, and I'm worried about any given one of them acting up and hogging all the system's resources. Immediately niceness comes to mind for me - I would give them all positive niceness values so they will use any resources if they're available but give them up if there is demand for them. Will this perform as I expect? Or if they all have the same niceness values, would it essentially be the same as them all being 0?
Basically I'm wondering how the kernel decides which processes should get priority, if they all have the same priority value and all need resources? Since there's only 39 possible niceness levels(-20 to +19 iirc), I couldn't give each server different values, if it worked that way.
Any clarification about this would be greatly appreciated.
Some other solutions I've come across to prevent hogging:
cpulimit
utility (which segfaults for me)ulimit
- per user basis, sounds ideal for me as each server has its own user, though it only offers cputime as a measurement of cpu resource usage. I'm curious if this means elapsed time or a percentage of cpu time per second or something else.- process control groups - From some initial skimming of google results this looks like a much more complicated solution, but it may have to come to that.