一、如何查看服务器的CPU
今天安装了9台Linux服务器,型号完全不一样(有DELL、HP和IBM服务器),又懒得去对清单,如何在Linux下cpu的个数和核数呢?另外,nginx的cpu工作模式也需要确切的知道linux服务器到底有多少个逻辑cpu,不过现在服务器那是相当的彪悍,直接上worker_processes 8吧。
判断依据:
1.具有相同core id的cpu是同一个core的超线程。(Physical id and core id are not necessarily consecutive but they are unique. Any cpu with the same core id are hyperthreads in the same core.)
2.具有相同physical id的cpu是同一颗cpu封装的线程或者cores。(Any cpu with the same physical id are threads or cores in the same physical socket.)
以自己的惠普DL380G6为例说明:
①物理cpu个数:
- [root@localhost ~]# cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
②每个物理cpu中core的个数(即核数)
- [root@localhost ~]# cat /proc/cpuinfo | grep "cpu cores" | uniq cpu cores : 4
这样可以推算出自己服务器的逻辑CPU为物理个数*核数,如果你的服务器是server2003,你可以在你的资源管理器里以图形化方式看到你的逻辑CPU个数。
- /proc/cpuinfo 描述中有 6 个条目适用于多内核和超线程(HT)技术检查:processor, vendor id, physica