前几天发了一篇“记一次linux服务器性能优化【分析篇】”:
这两天试了一下还是没法模拟我当时的环境,就我把我服务器调整后的状态贴出来,给大家一个参考,另外大家也帮忙看看我服务器还有那些性能问题,欢迎指出。
服务器状态读取的方法:
通过shell脚本在服务器负载超过10的时候收集服务器状态信息,现在这台服务器负载一般在10以内
- #!/bin/bash
- while true;do
- LOAD=`uptime |awk '{print $10}'|awk -F"," '{print $1}'|awk -F"." '{print $1}'`
- if [ "$LOAD" -ge "10" ];then
- echo "########## top ##########" >>/tmp/test.log
- top -n 3 >>/tmp/test.log
- echo "########## vmstat ##########" >>/tmp/test.log
- vmstat 1 10 >>/tmp/test.log
- echo "########## iostat ##########" >>/tmp/test.log
- iostat -x 1 5 >>/tmp/test.log
- echo "########## ifstat ##########" >>/tmp/test.log
- ifstat 1 10 >>/tmp/test.log
- echo "########## free ##########" >>/tmp/test.log
- free -m >>/tmp/test.log
- break
- else
- sleep 3
- fi
- done
nfs进程数:
- [root@node1.example.com ~]# ps -ef |grep nfs|wc -l
- 163
top信息,排版有点乱了:
- top - 17:14:50 up 26 days, 2:03, 2 users, load average: 10.83, 6.56, 5.01
- Tasks: 675 total, 1 running, 674 s 0 Sleeping, 0 stopped, 0 zombie
- Cpu(s): 0.1%us, 1.5%sy, 0.0%ni,97.2%id, 0.2%wa, 0.0%hi, 1.0%si, 0.0%st
- 2.0 0.0 42:56.64 nfsd
- 0 S 2.0 0.0 44:33.41 nfsd
- 0 0 0 S 0.0 0.0 59:11.27 ksoftirqd/5
- PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
- 29312 root 15 0 0 0 0 S 5.6 0.0 43:29.71 nfsd
- 59826268k cached
- 29359 root 15 0 0 0 0 S 3.6 0.0 42:56.75 nfsd
- root 15 0 0 0 0 S 1.6 0.0 43:29.54 nfsd
- 29294 root 15 0 0 0 0 S 3.0 0.0 43:36.88 nfsd
- root 15 0 0 0 0 S 1.6 0.0 42:54.01 nfsd
- 29309 root 15 0 0 0 0 S 3.0 0.0 46:02.95 nfsd
- root 15 0 0 0 0 S 1.6 0.0 45:41.01 nfsd
- 29307 root 15 0 0 0 0 S 2.6 0.0 45:54.53 nfsd
- root 16 0 13140 1568 808 S 1.3 0.0 0:08.75 top
- 29336 root 15 0 0 0 0 S 2.6 0.0 43:25.68 nfsd
- root 15 0 0 0 0 S 1.3 0.0 41:38.62 nfsd
- 24 root 35 19 0 0 0 S 2.3 0.0 29:10.30 ksoftirqd/7
- root 34 19 0 0 0 S 1.0 0.0 720:00.68 kipmi0
- 29399 root 15 0 0 0 0 S 2.3 0.0 42:22.31 nfsd
- root 14 -1 114m 1884 1460 S 0.7 0.0 33:08.94 modclusterd
- 29431 root 15 0 0 0 0 S 2.3 0.0 41:38.69 nfsd
- root 34 19 0 0 0 S 0.3 0.0 29:10.23 ksoftirqd/7
- 29327 root 15 0 0 0 0 S 2.0 0.0 48:11.78 nfsd
- root 18 0 65956 1232 1024 S 0.3 0.0 11:31.35 ping.sh
- 29363 root 15 0 0 0 0 S 2.0 0.0 42:54.07 nfsd
- root 10 -5 0 0 0 S 0.3 0.0 6:45.87 dlm_astd
- root 15 0 0 0 0 S 0.3 0.0 42:22.24 nfsd
- 29400 root 15 0 0 0 0 S 2.0 0.0 44:33.47 nfsd
- root 15 0 10348 688 580 S 0.0 0.0 0:05.57 init
- 29422 root 15 0 0 0 0 S 2.0 0.0 44:59.68 nfsd
- root RT -5 0 0 0 S 0.0 0.0 0:05.64 migration/0
- 24192 root 16 0 13140 1568 808 S 1.6 0.0 0:08.80 top
- root 34 19 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/0
- 29304 root 15 0 0 0 0 S 1.6 0.0 42:56.77 nfsd
- root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
- 29356 root 15 0 0 0 0 S 1.6 0.0 43:06.90 nfsd
- root RT -5 0 0 0 S 0.0 0.0 0:04.08 migration/1
- 29433 root 15 0 0 0 0 S 1.6 0.0 41:20.85 nfsd
- root 34 19 0 0 0 S 0.0 0.0 31:54.68 ksoftirqd/1
- 29437 root 15 0 0 0 0 S 1.6 0.0 45:41.06 nfsd
- root RT -5 0 0 0 S 0.0 0.0 0:00.11 watchdog/1
- 26880 root 15 0 13140 1556 804 R 1.3 0.0 0:00.16 top
- RT -5 0 0 0 S 0.0 0.0 0:00.10 migration/2
- 29409 root 15 0 0 0 0 S 1.3 0.0 40:58.08 nfsd
- root 34 19 0 0 0 S 0.0 0.0 0:01.21 ksoftirqd/2
- 8037 root 34 19 0 0 0 S 1.0 0.0 720:00.71 kipmi0
- root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/2
- 10269 root RT 0 177m 79m 53m S 0.3 0.1 113:02.25 ai***ec
- root RT -5 0 0 0 S 0.0 0.0 0:00.98 migration/3
- 24174 root 16 0 90100 3288 2532 S 0.3 0.0 0:09.05 sshd
vmstat信息:
iostat信息:
ifstat信息:
free信息:
这个状态服务器还不是很忙,当客户端有大程序跑的时候,这台服务器内存会被耗光,网络流量在110M/s左右,io占满,这个时候服务器负载在25-30之间。
nfs服务给我的感觉是消耗内存、网络、io,对CPU要求不高。
每个人应用的环境不一样,得出的结论可能也不一样,欢迎拍砖:>
阅读(2539) | 评论(0) | 转发(0) |