performance tuning
Performance Tools include
ps
show processes
# ps
PID TTY TIME CMD
30138 pts/0 00:00:01 bash
2354 pts/0 00:00:00 ps
pstree
show process tree
# pstree -cpl
init(1)- -crond(1476)
|-gpm(1456)
|-httpd(1519)- -httpd(1701)
| |-httpd(17543)
| |-httpd(17545)
| |-sh(1700)
| |-sh(1705)
| |-sh(1706)
| |-sh(1707)
| `-sh(1708)
|-keventd(2)
|-khubd(83)
|-kjournald(16)
|-kjournald(270)
|-kjournald(271)
|-klogd(1175)
|-lockd(13904)
top
show top processes
top - 17:22:53 up 7:23, 4 users, load average: 0.11, 0.31, 0.48
Tasks: 110 total, 1 running, 108 sleeping, 0 stopped, 1 zombie
Cpu(s): 4.7% us, 11.3% sy, 0.0% ni, 82.0% id, 2.0% wa, 0.0% hi, 0.0% si
Mem: 1027228k total, 976288k used, 50940k free, 9564k buffers
Swap: 2048276k total, 29560k used, 2018716k free, 518336k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME COMMAND
3117 root 15 0 200m 59m 11m S 2.0 5.9 15:57.03 X
1 root 16 0 2228 548 472 S 0.0 0.1 0:00.51 init
2 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
you can get top to refresh every 5 seconds by entering "s" followed by ".2" or even 5 times a second by entering "s" followed by ".2" !
free
show free memory space
total used free shared buffers cached
Mem: 191244 188188 3056 424 7932 65344
-/ buffers/cache: 114912 76332
Swap: 1534196 109212 1424984
vmstat
vm stats
procs memory swap io system cpu
r b swpd free buff cache si so bi bo in cs us sy id wa
2 1 0 8796 582176 386188 0 0 31 66 78 52 3 12 70 15
mpstat
mp stats
Linux 2.6.9-11.EL (pc66.rentokil.com) 20/09/05
12:27:45 CPU %user %nice %system %iowait %irq %soft %idle intr/s
12:27:45 all 9.75 0.91 30.61 7.37 0.26 0.06 51.05 1120.40
iostat
io stats
Linux 2.4.21-32.EL (www.osde.info) 19/09/05
avg-cpu: %user %nice %sys %iowait %idle
3.03 0.00 14.91 14.15 67.92
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 0.49 2.77 6.29 1266680 2873570
sda1 0.00 0.00 0.00 358 98
sda2 0.49 2.77 6.29 1265834 2873472
sda3 0.00 0.00 0.00 168 0
sdb 8.54 1418.14 372.91 647812930 170348368
sdb1 8.54 1418.14 372.91 647812810 170348368
sdc 7.34 1693.89 77.13 773773986 35232480
sdc1 7.34 1693.89 77.13 773773866 35232480
sdd 228.14 3521.39 7006.04 1608582338 3200387128
sdd1 228.14 3521.38 7006.04 1608582218 3200387128
sar
show system activity
Linux 2.6.9-11.EL (www.osde.info) 19/09/05
16:10:01 CPU %user %nice %system %iowait %idle
16:20:01 all 12.92 0.02 10.96 0.95 75.16
16:30:01 all 8.31 0.02 9.72 1.16 80.79
16:40:01 all 12.07 0.03 10.17 0.45 77.27
16:50:01 all 16.61 0.02 11.86 1.15 70.36
17:00:01 all 10.56 0.02 14.22 1.82 73.38
17:10:01 all 13.95 0.02 10.90 0.99 74.14
17:20:01 all 16.23 0.02 11.12 0.66 71.96
Average: all 12.95 0.02 11.28 1.03 74.72
The last two are not installed by default so use the
RedHatPackageManager to install the
SysStat package which
provides the sar and iostat commands for Linux. Sar and iostat enable system monitoring of disk, network, and other IO activity.
CentOS 3.x
rpm -ivh /mnt/temp/RedHat/RPMS/sysstat-5.0.5-5.rhel3.i386.rpm
CentOS 4.x
rpm -ivh /media/cdrecorder/CentOS/RPMS/sysstat-5.0.5-1.i386.rpm
load testing
Use a lot of CPU
$ while true ; do true ; done &
then do a
see 100% cpu then
REFERRERS
SysAdmin
There are no comments on this page. [Add comment]