Setting the number of cores per CPU in a virtual machine
search cancel

Setting the number of cores per CPU in a virtual machine

book

Article ID: 309040

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

This article provides information on setting number of cores per CPU in a virtual machine.


Environment

VMware vCenter Server 

VMware vSphere ESXi 

Resolution

Important:

  • You can add, change, or configure CPU resources to improve virtual machine performance.
  • Most of the CPU parameters can be set when you create virtual machines or after the guest operating system is installed.
  • Some actions require that you power off the virtual machine before you change the settings.
  • For more information on maximum CPUs allowed, see vSphere Configuration Limits.

Prerequisites:

  • If CPU hot add is not enabled, turn off the virtual machine before adding CPUs.
  • To hot add multicore CPUs, verify that the virtual machine compatibility is ESXi 5.0 and later.
  • Required privilege: Virtual Machine > Configuration > Change CPU Count on the virtual machine

Procedure to set the number of cores per CPU in a VM:

Step 1: Determine the total number of vCPUs to allocate to the virtual machine.

To calculate virtual machine CPUs within the vSphere Client, multiply the number of sockets selected by the number of cores selected.
This table provides the examples of socket determination based on CPU and Cores per Socket within the vSphere Web Client:
 
Total Number of
virtual CPUs (CPU)
Cores per SocketNumber of Sockets determined
by the vSphere Web Client
111
221
212
441
422
414
881
824
842
818

 

Step 2: Set the number of vCPUs.
  1. Login to the vSphere Web Client and select the virtual machine in question.
  2. Right-click on the virtual machine and select Edit Settings.
  3. Under the CPU field within the Virtual Hardware tab, select the total number of vCPUs determined in Step 1.
  4. Under the Core per Socket field, enter the total number of cores you would like to allocate to a socket. See illustration below:


Additional Information

Understanding the terminologies

VMware uses the following terminology. Understanding these terms can help you plan your strategy for CPU resource allocation.

Terminology

Description

CPU

 

 

The CPU, or processor, is the component of a computer system that performs the tasks required for computer applications to run. The CPU is the primary element that performs the computer functions. CPUs contain cores.

CPU Socket

 

A CPU socket is a physical connector on a computer motherboard that connects to a single physical CPU. Some motherboards have multiple sockets and can connect multiple multicore processors (CPUs).

Core

 

A core contains a unit containing an L1 cache and functional units needed to run applications. Cores can independently run applications or threads. One or more cores can exist on a single CPU.

 

Setting the Number of Virtual CPUs in the vSphere Client


To set the Number of Virtual CPUs in the vSphere Client, refer the Virtual CPU Configuration section of Virtual Machine Administration Guide.

Notes: When configuring virtual CPUs within the vSphere Web Client, you can configure:

  • The total number of vCPUs for the virtual machine
  • The total number of Cores per Socket

Admin guide links:

Tweaks to consider when you are using older Guest OS versions:


If you are using operating systems that were released when SMP was a high-end server-only, you expect that you need to do some tweaks such as selecting SMP kernel for Linux virtual machines and Multiprocessor PC HAL for Windows virtual machines.

Note: You do not encounter problems with recent operating systems. XP and newer and RHEL5 and newer either always install SMP kernel or automatically switch to it.
Some examples of the older operating system versions are:
  • RHel3-ES32
  • RHel3-ES64
  • RHel4.8-AS32
  • RHel4.7-ES32
  • RHel4.7-ES64
  • Win2000-Pro
  • Win2000-Serv
Notes:
  • In vSphere 5.0 with Enterprise Plus Licensing and Virtual Machine Hardware Version 8, the maximum number of vCPUs per Virtual Machine is 32.
  • In vSphere 5.0 with Virtual Machine Hardware Version 7, the maximum number of vCPUs per Virtual Machine is 8.
  • For more information on maximum CPUs allowed, see vSphere 5.0 Configuration Maximums.

Best Practices