Limiting CPU Usage of Apache and Other Apps

kml

Registered
Is there a way to set a Maximum CPU usage in OS X or in General unix life? I've stumbled across a program error in PHP that made Apache take up 98.2% CPU. So is there like a kernel settting or a setting in Apache for this??
 
I've heard of a unix command qualifier termed "nice". I believe it limits the amount of cpu time a process uses.

Rich G.
 
Nice doesn't actually limit the CPU usage, it just sets process priority. That means that processes with equal priority always get equal amounts of CPU, but will never take CPU away from processes with higher priorities.

The computer should stay responsive if you give Apache a lower priority. It might still take up 98% of your processor, but it won't take any processor at all if you are trying to do something.

At least, it would mean that on any other Unix OS. Here's the trick - nice numbers/process priorities haven't been implemented in the version of Darwin that underlies OS X PB. I don't know whether the current version of Darwin has this implemented, or whether it will work by OS X final...
 
How did Ryan get so far with his <A HREF="http://www.versiontracker.com/moreinfo.fcgi?id=9473" TARGET="_blank">Nicer app</A> if nicing isn't implemented yet?

I'll try it, see if it actually changes process priority.
 
nice and renice have no noticeable effect in the PB or final. nicer is fun app. i believe it was more an experiment in tieing together command line utilities and aqua.

-cs-
 
The API for nice is implemented, but the actual functioning is not. It's just like a dummy thermostat - you can fiddle with the knobs all you want, it won't change the temperature one bit.
 
Back
Top