Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1427780
  • 博文数量: 842
  • 博客积分: 12411
  • 博客等级: 上将
  • 技术积分: 5772
  • 用 户 组: 普通用户
  • 注册时间: 2011-06-14 14:43
文章分类

全部博文(842)

文章存档

2013年(157)

2012年(685)

分类: LINUX

2012-03-18 00:57:15

linux性能分析工具以及参数说明

性能分析工具


CPU性能分析工具:

vmstat

ps

sar


time

strace

pstree

top

Memory性能分析工具:

vmstat

strace

top

ipcs

ipcrm

cat /proc/meminfo

cat /proc/slabinfo

cat /proc//maps

I/O性能分析工具:

vmstat

ipstat

repquota

quotacheck

Network性能分析工具:

ifconfig

ethereal

tethereal

iptraf

iwconfig

nfsstat

mrtg

ntop

netstat

cat /proc/sys/net

Linux 性能调优工具

当通过上述工具及命令,我们发现了应用的性能瓶颈以后,我们可以通过以下工具或者命令来进行性能的调整。

CPU性能调优工具:

nice / renic

sysctl

Memory性能调优工具:

swapon

ulimit

sysctl

I/O性能调优工具:

edquota

quoton

sysctl

boot line:

elevator=

Network性能调优工具:

ifconfig

iwconfig

sysctl

CPU性能调整

当一个系统的CPU空闲时间或者等待时间小于5%时,我们就可以认为系统的CPU资源耗尽,我们应该对CPU进行性能调整。

CPU性能调整方法:


编辑/proc/sys/kernel/中的文件,修改内核参数。

#cd /proc/sys/kernel/

# ls /proc/sys/kernel/

acct hotplug panic real-root-dev

cad_pid modprobe panic_on_oops sem

cap-bound msgmax pid_max shmall

core_pattern msgmnb powersave-nap shmmax

core_uses_pid msgmni print-fatal-signals shmmni

ctrl-alt-del ngroups_max printk suid_dumpable

domainname osrelease printk_ratelimit sysrq

exec-shield ostype printk_ratelimit_burst tainted

exec-shield-randomize overflowgid pty threads-max

hostname overflowuid random version

一般可能需要编辑的是pid_max和threads-max,如下:

# sysctl kernel.threads-max

kernel.threads-max = 8192

# sysctl kernel.threads-max=10000

kernel.threads-max = 10000


Memory性能调整

当一个应用系统的内存资源出现下面的情况时,我们认为需要进行Memory性能调整:

页面频繁换进换出;

缺少非活动页。

例如在使用vmstat命令时发现,memory的cache使用率非常低,而swap的si或者so则有比较高的数据值时,应该警惕内存的性能问题。

Memory性能调整方法

1。关闭非核心的服务进程。

相关的方法请见CPU性能调整部分。

2。修改/proc/sys/vm/下的系统参数。

# ls /proc/sys/vm/

block_dump laptop_mode nr_pdflush_threads

dirty_background_ratio legacy_va_layout overcommit_memory

dirty_expire_centisecs lower_zone_protection overcommit_ratio

dirty_ratio max_map_count page-cluster

dirty_writeback_centisecs min_free_kbytes swappiness

hugetlb_shm_group nr_hugepages vfs_cache_pressure

# sysctl vm.min_free_kbytes

vm.min_free_kbytes = 1024

# sysctl -w vm.min_free_kbytes=2508

vm.min_free_kbytes = 2508

# cat /etc/sysctl.conf

vm.min_free_kbytes=2058

3。配置系统的swap交换分区等于或者2倍于物理内存。

# free

total used free shared buffers cached

Mem: 987656 970240 17416 0 63324 742400

  • 注:暂存的内容只能恢复到当前文章的编辑器中,如需恢复到其他文章中,请编辑该文章并从暂存箱中恢复;或者直接复制以上内容,手工恢复到相关文章。
  • 阅读(359) | 评论(0) | 转发(1) |
    给主人留下些什么吧!~~