系统分析基本工具

cpu性能分析工具

[root@k8s-master01 ~]# LANG=C    #将时间从12小时制换成24小时
[root@k8s-master01 ~]# mpstat 1 3   #每一秒统计一次cpu状态,一共统计3次
Linux 3.10.0-1160.el7.x86_64 (k8s-master01)     09/01/21     _x86_64_    (4 CPU)
                                            磁盘等待                        消耗的cpu          cpu空闲
22:58:43     CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
22:58:44     all    1.78    0.00    1.27    0.00    0.00    0.00    0.00    0.00    0.00   96.95
22:58:45     all    3.29    0.00    1.52    0.51    0.00    0.25    0.00    0.00    0.00   94.43
22:58:46     all    3.05    0.00    1.53    0.00    0.00    0.25    0.00    0.00    0.00   95.17
Average:     all    2.71    0.00    1.44    0.17    0.00    0.17    0.00    0.00    0.00   95.52
[root@k8s-master01 ~]# lscpu    #查看cpu硬件信息
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    2
Socket(s):             2
NUMA node(s):          1
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Model name:            Intel(R) Xeon(R) CPU E5-2603 v2 @ 1.80GHz
Stepping:              4
CPU MHz:               1800.000
BogoMIPS:              3600.00
Hypervisor vendor:     VMware
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              10240K
NUMA node0 CPU(s):     0-3
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc eagerfpu pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm ssbd ibrs ibpb stibp fsgsbase tsc_adjust smep arat md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities

[root@k8s-master01 ~]# free -m total used free shared buff/cache available Mem: 3770 1377 165 29 2227 2092 Swap: 0 0 0

显示内存所有信息

[root@k8s-master01 ~]# cat /proc/meminfo 
MemTotal:        3861288 kB
MemFree:          168784 kB
MemAvailable:    2142064 kB
Buffers:            3136 kB
Cached:          2132620 kB
SwapCached:            0 kB
Active:          2135336 kB
Inactive:        1002164 kB
Active(anon):    1014328 kB
Inactive(anon):    18104 kB
Active(file):    1121008 kB
Inactive(file):   984060 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                72 kB
Writeback:             0 kB
AnonPages:       1001744 kB
Mapped:           285704 kB
Shmem:             30688 kB
Slab:             304484 kB
SReclaimable:     145604 kB
SUnreclaim:       158880 kB
KernelStack:       12912 kB
PageTables:        11008 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1930644 kB
Committed_AS:    5543572 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      194108 kB
VmallocChunk:   34359310332 kB
Percpu:            38912 kB
HardwareCorrupted:     0 kB
AnonHugePages:    522240 kB
CmaTotal:              0 kB
CmaFree:               0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:      192320 kB
DirectMap2M:     4001792 kB

vmstat命令

[root@k8s-master01 ~]# vmstat -a 1 5
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
 r  b   swpd   free  inact active   si   so    bi    bo   in   cs us sy id wa st
 1  0      0 170604 1002256 2133956    0    0     3    20    6    8  4  2 94  0  0
 0  0      0 170672 1002292 2134580    0    0     0    50 4352 7870  3  2 93  1  0
 0  0      0 170676 1002292 2134672    0    0     0   120 3310 5893  2  1 97  0  0
 0  0      0 170676 1002292 2134696    0    0     0    41 3891 7101  2  2 96  0  0
 0  0      0 170800 1002292 2134720    0    0     0     4 3295 6003  2  1 97  0  0

HDD磁盘调度算法

[root@k8s-master01 ~]# cat /sys/block/sda/queue/scheduler   #查看 
noop [deadline] cfq 

[root@k8s-master01 ~]# echo cfq > /sys/block/sda/queue/scheduler   #修改为cfq
[root@k8s-master01 ~]# cat /sys/block/sda/queue/scheduler 
noop deadline [cfq] 

 

上一篇:kubernetes安装


下一篇:kubeadm部署的测试环境k8s集群更改matser节点的名字