linux下如何查看服务器的硬件配置信息
性能测试时一定要确定测试环境和的硬件配置、软件版本配置,保证和线上一致,才更接近真实环境。
那么linux下如何查看服务器的硬件配置信息??
一、查看cpu信息
1、所有信息 lscpu
[root@redis02 ~]# lscpu Architecture: x86_64 ##cpu架构 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 8 ##总共有8核 On-line CPU(s) list: 0-7 Thread(s) per core: 1 ##每个cpu核,只能支持一个线程,即不支持超线程 Core(s) per socket: 8 ##每个cpu,有8个核 Socket(s): 1 ##总共有1一个cpu NUMA node(s): 1 Vendor ID: GenuineIntel CPU family: 6 Model: 79 Model name: Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz Stepping: 1 CPU MHz: 2095.139 BogoMIPS: 4190.27 Hypervisor vendor: Microsoft Virtualization type: full L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 20480K NUMA node0 CPU(s): 0-7
2、查看逻辑cpu的数量
cat /proc/cpuinfo |grep "processor"|sort -u|wc -l
3、查看物理cpu的数量
grep "physical id" /proc/cpuinfo|sort -u|wc -l
4、查看每个物理cpu的内核数
grep "cpu cores" /proc/cpuinfo|uniq
5、每个物理CPU上逻辑CPU个数
grep "siblings" /proc/cpuinfo|uniq
6、判断是否开启了抄超线程:
如果多个逻辑CPU的"physical id"和"core id"均相同,说明开启了超线程
或者换句话说
逻辑CPU个数 > 物理CPU个数 * CPU内核数 开启了超线程
逻辑CPU个数 = 物理CPU个数 * CPU内核数 没有开启超线程
二、查看内存信息
1、free -m
[root@redis02 ~]# free -m total used free shared buffers cached Mem: 16071 8041 8029 0 143 6487 -/+ buffers/cache: 1411 14659 Swap: 8039 36 8003
2、查看内存详细信息 cat /proc/meminfo
[root@redis02 ~]# cat /proc/meminfo MemTotal: 16456948 kB MemFree: 8222176 kB Buffers: 146532 kB Cached: 6643084 kB SwapCached: 3200 kB Active: 6315476 kB Inactive: 1478136 kB Active(anon): 338812 kB Inactive(anon): 665832 kB Active(file): 5976664 kB Inactive(file): 812304 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 8232956 kB SwapFree: 8195644 kB Dirty: 16 kB Writeback: 0 kB AnonPages: 1001364 kB Mapped: 14560 kB Shmem: 648 kB Slab: 283984 kB SReclaimable: 221920 kB SUnreclaim: 62064 kB KernelStack: 5472 kB PageTables: 5952 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 16461428 kB Committed_AS: 752588 kB VmallocTotal: 34359738367 kB VmallocUsed: 65856 kB VmallocChunk: 34359659968 kB HardwareCorrupted: 0 kB AnonHugePages: 962560 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 14272 kB DirectMap2M: 16762880 kB