linux主机性能
主机性能
http://blog.csdn.net/tianlesoftware/article/details/6198780
iftraf-ng使用,查看端口流量
http://www.cnblogs.com/taosim/articles/4030292.html
top详解
http://www.cnblogs.com/dragonsuc/p/5512797.html
查看主机配置
CPU信息
[root@cbill11 ~]# # 总核数 = 物理CPU个数 X 每颗物理CPU的核数 [root@cbill11 ~]# # 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU的核数 X 超线程数 [root@cbill11 ~]# [root@cbill11 ~]# # 查看物理CPU个数 [root@cbill11 ~]# cat /proc/cpuinfo| grep "physical id"| sort| uniq| wc -l 4 [root@cbill11 ~]# # 查看每个物理CPU中core的个数(即核数) [root@cbill11 ~]# cat /proc/cpuinfo| grep "cpu cores"| uniq cpu cores : 8 [root@cbill11 ~]# # 查看逻辑CPU的个数 [root@cbill11 ~]# cat /proc/cpuinfo| grep "processor"| wc -l 64 [root@cbill11 ~]# # 查看cpu是否超线程 [root@cbill11 ~]# # 如果有两个逻辑CPU具有相同的”core id”,那么超线程是打开的。或者siblings数目比cpu cores数目大 [root@cbill11 ~]# cat /proc/cpuinfo | grep "siblings" | wc -l 64 [root@cbill11 ~]# #查看CPU信息(型号) [root@cbill11 ~]# cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c 64 Intel(R) Xeon(R) CPU E5-4610 v2 @ 2.30GHz [root@cbill11 ~]# [root@cbill11 ~]# #CPU运行模式(32/64) [root@cbill11 ~]# getconf LONG_BIT 64 [root@cbill11 ~]#
内存,也可以通过top和nmon查看内存信息
[root@cbill11 ~]# #查看内 存信息 ,粘贴部分返回信息 [root@cbill11 ~]# cat /proc/meminfo MemTotal: 528145584 kB MemFree: 731812 kB MemAvailable: 516061584 kB Buffers: 4940 kB Cached: 500859468 kB SwapCached: 0 kB Active: 78936812 kB Inactive: 429377380 kB Active(anon): 5314528 kB Inactive(anon): 2159784 kB Active(file): 73622284 kB Inactive(file): 427217596 kB
主机型号
[root@cbill11 ~]# dmidecode | grep "Product Name" Product Name: PowerEdge R820 Product Name: 0JC2W3 [root@cbill11 ~]#
网卡 lspci ifconfig ethtool
[root@cbill11 ~]# lspci -vvv | grep Ethernet 01:00.0 Ethernet controller: Broadcom Corporation BCM57840 NetXtreme II 10 Gigabit Ethernet (rev 11) Product Name: QLogic 57840 10 Gigabit Ethernet 01:00.1 Ethernet controller: Broadcom Corporation BCM57840 NetXtreme II 10 Gigabit Ethernet (rev 11) Product Name: QLogic 57840 10 Gigabit Ethernet 01:00.2 Ethernet controller: Broadcom Corporation BCM57840 NetXtreme II 10 Gigabit Ethernet (rev 11) Product Name: QLogic 57840 10 Gigabit Ethernet 01:00.3 Ethernet controller: Broadcom Corporation BCM57840 NetXtreme II 10 Gigabit Ethernet (rev 11) Product Name: QLogic 57840 10 Gigabit Ethernet [root@cbill11 ~]# # 查看使用的网卡 [root@cbill11 ~]# ifconfig -a [root@cbill11 ~]# # 查看网卡速度 [root@cbill11 ~]# ethtool bond0 Settings for bond0: Supported ports: [ ] Supported link modes: Not reported Supported pause frame use: No Supports auto-negotiation: No Advertised link modes: Not reported Advertised pause frame use: No Advertised auto-negotiation: No Speed: 10000Mb/s Duplex: Full Port: Other PHYAD: 0 Transceiver: internal Auto-negotiation: off Link detected: yes [root@cbill11 ~]#
性能监控
top
- b 开启/关闭加亮效果
- y 开启/关闭运行状态加亮
- x 开启/关闭排序列的加量效果(默认加量%CPU)
- shift + > / shift + < 向右/向左改变排序列
- f 进入top编排字段,可以增加显示列,使用说明很详细,P表示进行绑定的cpu号
- 1 显示所有cpu core的使用情况,默认显示平均值,cpu数量太多时,无法显示全部core,也可以用于查看cpu数量
vmstat
vmstat -s -S M 通过-S M或-S k可以指定查看的单位,默认为kb
[root@cbill11 ~]# vmstat -s -S M
515767 M total memory
11051 M used memory
77153 M active memory
419207 M inactive memory
742 M free memory
4 M buffer memory
503968 M swap cache
65535 M total swap
0 M used swap
65535 M free swap
23021681 non-nice user cpu ticks
245 nice user cpu ticks
22082935 system cpu ticks
2929472122 idle cpu ticks
838004 IO-wait cpu ticks
0 IRQ cpu ticks
329135 softirq cpu ticks
0 stolen cpu ticks
5551342 pages paged in
1306866995 pages paged out
0 pages swapped in
0 pages swapped out
2492762186 interrupts
3234817157 CPU context switches
1494816531 boot time
813947 forksvmstat 1 5
[root@cbill11 ~]# vmstat 1 5
procs ———–memory———- —swap– —–io—- -system– ——cpu—–
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 830888 4940 515998080 0 0 0 44 0 1 1 1 98 0 0
0 0 0 830492 4940 515998080 0 0 0 21 4050 6924 0 1 98 0 0
0 0 0 831064 4940 515998080 0 0 0 0 3651 5828 0 1 99 0 0
0 0 0 830916 4940 515998080 0 0 0 12 3957 7309 1 1 98 0 0
0 0 0 831400 4940 515998080 0 0 0 0 2898 4449 0
[root@cbill11 ~]#
mpstat
- mpstat -P ALL 10 间隔10s,采样一次CPU的使用情况,每个core都会采集
pidstat -p
pidof 进程名
-t 1 查看进程使用cpu情况,如果绑定了多个cpu会都显示出来iptraf-ng 端口流量查看
启动,进入图形界面
[root@cbill11 ~]# iptraf-ng
配置, Configure —— Additional ports;添加扫描的端口区间
- 监控, Statistical breakdowns —— By TCP/UDP port —— eth0;查看eth0网卡的某个指定端口的带宽占用和流量
最近系统做压测,找了一些资料,这里总了一些汇总,mark以防忘记,前面的帖子,写的很精彩。