文档介绍:Linux操作系统系统优化
周炯
上海艾基信息技术有限公司
内容提要
Performance concepts and measurement tools:
CPU
Memory
Disk I/work
Process
Profiling Kernel & Applications
Measurement Tools
Linux has measurement mon toUNIX platforms:
System Activity Reporter: sar
Historical database
Virtual Memory Statistics: vmstat, free
I/O Statistics: iostat
Top Resource Consumers: top -c
X-based tools: xosview, gnome-system-monitor, ksysguard, gkrellm
CPU Measurements
Identify the CPU statistics and interpret them:
Idle time: %idle
Executing user code: %user
Executing system code: %system
Load average: runq-sz
Start with cat /proc/cpuinfo
Total CPU count/speed
There are several ways to see the same information, for example: CPU activity
CPU Activity - mpstat
# mpstat -P <cpu> <interval> <count>
# mpstat -P ALL 1 1
Linux - (raclinux1) 08/04/2004
CPU %user %nice %system %idle intr/s
all
0
1
What is my CPU doing?: mpstat
CPU Activity - sar
# sar -u 2 3
Linux - (raclinux1) 08/04/2004
02:02:34 AM CPU %user %nice %system %idle
02:02:36 AM all
02:02:38 AM all
02:02:40 AM all
Average: all
# sar -u <interval> <count>
What is my CPU doing?: sar
CPU Activity - iostat
# iostat -c 2 3
Linux - (raclinux1) 08/04/2004
avg-cpu: %user %nice %sys %idle
avg-cpu: %user %nice %sys %idle
avg-cpu: %user %nice %sys %idle
# iostat -c <interval> <count>
What is my CPU doing?: iostat
Linux Virtual Memory
Each process is assigned a contiguous address space in virtual memory that maps process memory allocations to the real memory
User address space is a contiguous set of pages and is limited to 4GB per process
Physical Address Extension (PAE), allows access to more than 4GB of physical memory
RHat: ‘enterprise’ kernel (implied SMP)
SuSE: 64GB