Changing the nice() value of a running process.

Michael R. Johnston mikej at lilink.UUCP
Fri Jan 20 11:55:59 AEST 1989


Today on a whim I did something on my system which quite interestingly
enough improved performance measurably. Perhaps someone can explain in
technical terms why this works. 

One of the systems I administer at work is an Altos 386/2000 running SVR3
Unix. This system is a 64 port box. Typically, we have about 30 to 35
users on simultaneously running our database applications software.

Before I made my change today, the system usually became just a tad sluggish
after about 25 to 30 users were online. Not enough to complain about but just
enough so the cursor would sometimes hesitate for a second or two. The system
doesn't swap since we have 16 meg of ram and sar reports several hundred
free block even on the heaviest of days.

When I ran sar I usually came out with an "idle%" figure of less than 10 
during mid-day loads. What I did was to change the invocation of the
program from:

program

to:

nice -10 program.

By golly, suddenly the cursor stopped hesitating and when I re-ran sar I
got figures that were in the 50 to 60 percent range. After some playing with
the nice() value I  was able to get a final result in the range of 60 to 70
percent most of the time. I was ecstatic! (as only a sysadmin can be...)

I don't know the technical reasons behind this but I can surmise the following.
By lowering the nice() value accross the board equally we devote less time
to idle processes which are probably in the majority at any given moment. 
Remember that this is an online database that is only queried on demand.
Having done this, it then has more time to service the important requests 
for work. Am I completely off base?

Now that I have discovered this I have had another thought. Could I 
automatically alter the nice() value of one of these running processes based 
upon the time it has been sitting idle via a daemon? I.E. could I check the
idle time for the tty every minute or so and adjust nice() for it lower and
lower until it finally came back into use? This sounds like the perfect
performance tuning tool. It could also have a preset threshold that would just
kill the user altogther once idle time had been exceeded.

Anyone?
---
Michael R. Johnston
System Administrator   {..!philabs!mergvax! | ..!uunet!ispi!} lilink!mikej
LILINK - Public Access Xenix   (516) 872-2137  1200/2400 8N1  Login: new



More information about the Comp.unix.wizards mailing list