VMware CPU超线程是否启用
首先,我们需要了解什么是超线程,超线程技术是在一颗CPU同时执行多个程序而共同分享一颗CPU内的资源,理论上要像两颗CPU一样在同一时间执行两个线程,P4处理器需要多加入一个Logical CPU Pointer(逻辑处理单元)。因此新一代的P4 HT的die的面积比以往的P4增大了5%。而其余部分如ALU(整数运算单元)、FPU(浮点运算单元)、L2 Cache(二级缓存)则保持不变,这些部分是被分享的。
虽然采用超线程技术能同时执行两个线程,但它并不象两个真正的CPU那样,每各CPU都具有独立的资源。当两个线程都同时需要某一个资源时,其中一个要暂时停止,并让出资源,直到这些资源闲置后才能继续。因此超线程的性能并不等于两颗CPU的性能。
我们在了解超线程后,我们现在需要了解在VMware中启用超线程对我们的虚拟机的系统是否有所帮助。从下面的官方原文中可以看出VMware是建议开启超线程。
HT must be enabled in the server BIOS and configured via the VI Client for VI3, or configured in the startup profile of the ESX host (/etc/vmware/hwconfig requires an option hyperthreading=’true’) for VI2. Enabling this option requires a reboot of the host. Hyper-Threading support allows doubling the number of logical processors in an ESX host. However, HT improves utilization by supporting concurrent thread processing on the same physical CPU to take advantage of idle thread cycles and therefore the boost is not equivalent to adding more physical processors.
Consider enabling HT as a default for older Intel servers (quad-core Intel servers no longer offer the option for HT). This can help performance, although not dramatically. In rare cases, enabling HT can hamper performance, so performance metrics should be monitored after changing this setting.
所以打开超线程后,大概可以获取20%左右的性能提升。对于超线程,最佳应用就是在一个CPU CORE里,一个运行浮点运算,另外一个运行整数运算。两个运算单元不会相互干扰,带来80%左右的性能提升。如果是事务处理,那提升不会那么明显。从下图中可以看出提升。
那么在实际环境中,建议开了不如不开。