LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Why am I getting ?high? CPU load? (http://www.linuxquestions.org/questions/linux-general-1/why-am-i-getting-high-cpu-load-103531/)

pnh73 10-13-2003 05:04 PM

Why am I getting ?high? CPU load?
 
Hi,

My server load sits constantly at ~3.0 and I am wondering if this is abnormally high for a fairly low traffic server running Apache 2.0.40, Postfix 1.12 with MailScanner, MySQL 3.23.58, SSH for SFTP transfers, SQUID 2.4 with DansGuardian and SAMBA 2.27 as a print server (last 3 only available on my LAN). These do not undergo a high usage. I am running RH8.0 and I am running web stats updates once an our which trawls through the web server logs for 3 sites and produces static pages via a perl script, this takes 6 minutes to complete for all three sites.

This is a typical uptime command output:

Code:

$ uptime
10:05pm  up 32 days, 23:53,  1 user,  load average: 4.00, 3.78, 3.48

Also could it be caused by the constant output of this error to screen?

Quote:

usb_control/bulk_msg: timeout
printer.c: usblp0: error -110 reading printer status
I know this was caused when i removed the usb printer cable from the computer, but how do i stop this error. :confused:

I have been scratching :scratch: my head about the load issues and am unsure if this is abnormal or not.

TIA

jharris 10-13-2003 05:12 PM

What does top show you as the most active process(es)? Remember that you load is a function of how active the CPU is and how long the waiting process list is. If you are running a lot of processes this will make you load higher as they're all waiting for the same cpu(s).

cheers

Jamie...

pnh73 10-13-2003 05:45 PM

Quote:

10:45pm up 33 days, 32 min, 1 user, load average: 3.00, 3.00, 3.07
89 processes: 81 sleeping, 2 running, 6 zombie, 0 stopped
CPU states: 7.9% user, 1.3% system, 0.0% nice, 90.6% idle
Mem: 126448K av, 122148K used, 4300K free, 0K shrd, 5792K buff
Swap: 257000K av, 91508K used, 165492K free 12640K cached
and here is a snapshot of the process list:

Quote:

PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
594 postfix 18 0 0 0 0 Z 8.5 0.0 0:00 MailScanner <defunct>
584 admin 15 0 1096 1096 828 R 0.7 0.8 0:00 top
17930 squid 15 0 15020 2292 2140 R 0.1 1.8 1:11 squid
1 root 15 0 404 360 336 S 0.0 0.2 0:04 init
2 root 15 0 0 0 0 SW 0.0 0.0 0:00 keventd
3 root 15 0 0 0 0 SW 0.0 0.0 0:00 kapmd
4 root 34 19 0 0 0 SWN 0.0 0.0 0:00 ksoftirqd_CPU0
5 root 15 0 0 0 0 SW 0.0 0.0 1:16 kswapd
6 root 15 0 0 0 0 SW 0.0 0.0 0:00 bdflush
7 root 15 0 0 0 0 SW 0.0 0.0 0:00 kupdated
8 root 25 0 0 0 0 SW 0.0 0.0 0:00 mdrecoveryd
12 root 15 0 0 0 0 SW 0.0 0.0 0:13 kjournald
67 root 15 0 0 0 0 DW 0.0 0.0 0:00 khubd
160 root 15 0 0 0 0 SW 0.0 0.0 0:00 kjournald
162 root 15 0 0 0 0 SW 0.0 0.0 0:13 kjournald
163 root 15 0 0 0 0 SW 0.0 0.0 1:48 kjournald
25605 root 15 0 2768 540 512 S 0.0 0.4 1:44 cupsd
17727 root 24 0 460 324 324 S 0.0 0.2 0:00 sh
17728 root 25 0 2100 184 184 S 0.0 0.1 0:01 rpm
20647 root 15 0 616 320 320 S 0.0 0.2 0:00 dhclient
32736 root 15 0 0 0 0 SW 0.0 0.0 0:07 kjournald
12400 lp 15 0 572 396 396 D 0.0 0.3 0:00 lpd
12401 lp 15 0 0 0 0 Z 0.0 0.0 0:00 mf_wrapper <defunct>
12416 lp 15 0 2384 1212 1212 D 0.0 0.9 0:00 lpdomatic
28773 root 15 0 0 0 0 SW 0.0 0.0 0:00 eth0
28824 root 15 0 612 316 316 S 0.0 0.2 0:00 dhclient
28863 root 15 0 416 380 328 S 0.0 0.3 0:39 syslogd
28867 root 15 0 340 324 280 S 0.0 0.2 0:00 klogd
28884 rpc 15 0 360 288 288 S 0.0 0.2 0:00 portmap
28903 rpcuser 18 0 460 360 360 S 0.0 0.2 0:00 rpc.statd
28968 root 15 0 356 304 304 S 0.0 0.2 0:00 apmd
29005 root 15 0 640 496 464 S 0.0 0.3 0:08 sshd
CPU usage seems low. Just that there are a lot of processes :scratch:

jqcaducifer 10-13-2003 08:21 PM

hm...
What's with the defunct mf_wrapper? not too sure what that is.
You have 2 dhclients running, don't know if this is necessary.
Why's there an rpm process?
And cups is usually for printers (i believe) if you killed your printer, you can disable this process.

pnh73 10-14-2003 12:27 PM

i have (had) two printers on the machine. One parallel one USB, now i have one Parallel. Can you give me some quick guidance about how to use kill?

TIA

jqcaducifer 10-14-2003 02:56 PM

There are definitely better more efficient ways, but to kill a process, i do
"ps -aux | grep <process>" where process is the name of the process...then see what the process ID is. Then
"kill <pid>", and do "ps -aux" again. If the process is still there and remains very stubborn, do
"kill -KILL <pid>"
that really kills them.

pnh73 10-15-2003 12:28 PM

wat are the more efficient ways?

jqcaducifer 10-15-2003 02:57 PM

Don't know. do "man kill" and "man grep" and "man ps" for more info. I know that there are many different ways to show only the pid of a process, and pipe that to kill, therefore only needing one command instead of 2 or 3, but the syntax is too complicated to remember, so I don't remember it.

pnh73 10-15-2003 05:24 PM

LOL, Cool, thanks for the help... going to murder some processes :p

pnh73 10-15-2003 05:40 PM

why why why isnt this working.. i do following:

Code:

[root@linux-hoster admin]# ps -aux | grep lpd
lp      12400  0.0  0.2  4692  364 ?        D    Sep25  0:00 lpd (Worker - Pri
lp        909  0.0  0.9  4668 1160 ?        S    22:31  0:00 lpd Waiting
root      928  0.0  0.4  3500  616 pts/0    S    22:32  0:00 grep lpd
[root@linux-hoster admin]# kill 12400
[root@linux-hoster admin]# ps -aux | grep lpd
lp      12400  0.0  0.2  4692  364 ?        D    Sep25  0:00 lpd (Worker - Pri
lp        909  0.0  0.9  4668 1160 ?        S    22:31  0:00 lpd Waiting
root      932  0.0  0.4  3500  616 pts/0    S    22:33  0:00 grep lpd
[root@linux-hoster admin]# kill -KILL 12400
[root@linux-hoster admin]# ps -aux | grep lpd
lp      12400  0.0  0.2  4692  364 ?        D    Sep25  0:00 lpd (Worker - Pri
lp        909  0.0  0.9  4668 1160 ?        S    22:31  0:00 lpd Waiting
root      935  0.0  0.4  3500  616 pts/0    S    22:33  0:00 grep lpd

Why isnt it working???

Would a 'soft' reboot help... do i do that by dropping to init 1 then back to init 3?

TIA

jharris 10-15-2003 06:56 PM

Quote:

Originally posted by pnh73
wat are the more efficient ways?
Code:

killall lpd
would be pretty clean and tidy. If you didn't have kill all then...
Code:

kill `ps -ef | grep [l]pd | awk '{ print $2 }' | tr "\n" " "`
would work too - note that those are back ticks aroung ps -ef | grep [l]pd | awk '{ print $2 }' | tr "\n" " ".

In case you were wondering ps -ef | grep [l]pd | awk '{ print $2 }' show the process list (ps), grep's out lines that contain 'lpd' but does't match the grep process itself (otherwise you kill grep before you search has finished!), then uses awk to print out the second column of each line which is the process ID. The tr "\n" " " changes the newlines into spaces so you get a list that can be fed into the kill command; this last bit might not be strictly necessary I'm not 100% sure how kill will interpret new lines inbetween it's list of pids.

cheers

Jamie...

pnh73 10-16-2003 11:47 AM

even with that the process is being extremely stubborn and wont die! As i ask before, would a soft reboot do it? (init 1)

tdemedts 10-21-2003 03:38 AM

I'm having a similar problem with acroread. From time to time, it somehow remains in the memory, and eats all the cpu time (99.9%). I just can't kill it. I thought it might have to do with other processes depending on it, but pstree shows that it's an independent process. I would be very glad if someone could tell me why this is happening, and how it can be solved... (By the way, I'm using an SMP kernel 2.4 on a P-IV with hyperthreading - I've no idea whether this could have something to do with it.)

KingMoffa 10-21-2003 09:16 AM

try a kill with -9.

This sends it a much nastier death threat.

tdemedts 10-21-2003 09:21 AM

Yes yes yes, tried all that. Doesn't work, not as regular user, and not as root. It's a -really- nasty process. (In case you're wondering, it's not a zombie process either, it's a real, running process.)


All times are GMT -5. The time now is 10:10 PM.