HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

NICE consuming high CPU

 
SOLVED
Go to solution
Kavita Poonia
Regular Advisor

NICE consuming high CPU

Hello All,

On one of our HP-UX server, NICE is having maximum contribution in keeping CPU to be 100% utilized. So just wanted to know the reason for that and how can we prevent this. Below are the stats taken from top command. I suspect it is because all the top processes have NICE value of 22 and not 20(default).

Load averages: 3.37, 3.80, 3.84
803 processes: 655 sleeping, 146 running, 2 stopped
Cpu states:
CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0 3.32 4.3% 86.6% 9.1% 0.0% 0.0% 0.0% 0.0% 0.0%
2 3.55 6.1% 78.3% 15.6% 0.0% 0.0% 0.0% 0.0% 0.0%
4 3.21 1.6% 94.9% 3.6% 0.0% 0.0% 0.0% 0.0% 0.0%
6 3.39 2.2% 83.8% 14.0% 0.0% 0.0% 0.0% 0.0% 0.0%
--- ---- ----- ----- ----- ----- ----- ----- ----- -----
avg 3.37 3.6% 86.0% 10.5% 0.0% 0.0% 0.0% 0.0% 0.0%

System Page Size: 4Kbytes
Memory: 25534184K (25214780K) real, 69598256K (65838156K) virtual, 12165272K free Page# 1/26

CPU TTY PID USERNAME PRI NI SIZE RES STATE TIME %WCPU %CPU COMMAND
0 ? 29825 uatenb1 152 22 2310M 352M run 0:22 90.85 63.48 java
4 ? 2004 root 255 28 51004K 35632K run 10:34 54.29 54.19 scan
6 ? 135 uatenb1 152 22 2306M 347M run 0:14 71.82 44.05 java
2 ? 140 uatenb1 152 22 2306M 350M run 0:11 76.52 38.52 java
6 ? 189 uatenb1 152 22 2298M 338M run 0:06 86.16 31.22 java
4 ? 209 uatenb1 152 22 2276M 318M run 0:02 63.23 11.46 java
10 REPLIES
Solution

Re: NICE consuming high CPU

>So just wanted to know the reason for that and how can we prevent this.

There is nothing to prevent, is working as it should. You want to use 100% of your CPUs.

>I suspect it is because all the top processes have NICE value of 22 and not 20 (default).

Yes.
Kavita Poonia
Regular Advisor

Re: NICE consuming high CPU

Thanks Dennis. Ya, its good if CPU is getting 100% utilized but its also causing high run-queue. We are seeing load average of 6 on this server which is not at all good for system health.

So, how can we bring them at nice value of 20 ?

R.O.
Esteemed Contributor

Re: NICE consuming high CPU

Hi,

You can do it with renice command: From man renice:

NAME
renice - alter priority of running processes

SYNOPSIS
renice [-n newoffset] [-g|-p|-u] id ...

.....

-n newoffset Change the system nice value of each affected
process to 20 + newoffset. If the UNIX95
environment variable is set, the system nice
value of each affected process is changed to
current nice value + newoffset.

If newoffset is negative, the system nice value is
set to 20 minus the absolute value of newoffset.
If the UNIX95 environment variable is set and the
newoffset is negative, the system nice value is
set to current nice value minus the absolute value
of newoffset. Only users with appropriate
newoffset is negative, the system nice value is
set to current nice value minus the absolute value
of newoffset. Only users with appropriate
privileges can reduce the system nice value or set
it to less than 20. If this option is omitted,
newoffset defaults to 10.


Regards,
"When you look into an abyss, the abyss also looks into you"

Re: NICE consuming high CPU

>but it's also causing high run-queue. We are seeing load average of 6 on this server which is not at all good for system health.

Are your users complaining about excessive response times?

>how can we bring them at nice value of 20?

As R.O. said, root can use "renice -n 0" on them. But this won't change your 100% CPU nor change your load average or high run-queue.
Kavita Poonia
Regular Advisor

Re: NICE consuming high CPU

Thanks Dennis,

Yes users are complaining....so making NICE value as 20 for those java processes will not help here ? Although NICE vakue of 20 has higher priority.

Thanks & regards,
Kavita

Re: NICE consuming high CPU

>so making NICE value as 20 for those java processes will not help here?

Yes, it will help users of just those processes. Users with nice value 22 will be slightly lower. Same with anyone already at 20, since they now have to compete with more processes.
Kavita Poonia
Regular Advisor

Re: NICE consuming high CPU

So, will it be recommendable here to change NICE value to 20 for those java processes here ?

Thanks & regards,
Kavita
Kavita Poonia
Regular Advisor

Re: NICE consuming high CPU

I mean from whole system performance's perspective....

Re: NICE consuming high CPU

>will it be recommendable here to change NICE value to 20 for those java processes here?

Sure, if this user is more important than the other nice users. But it appears that those users are probably getting all of the CPU they can.

>I mean from whole system performance's perspective.

The overall system performance shouldn't change that much. But it may starve the other users nice users.
Kavita Poonia
Regular Advisor

Re: NICE consuming high CPU

Thanks a lot Dennis for your help here. It's always difficult & find out adequate resolution for such performance issues :)