Configure CPU Cores per Socket


Background

In private cloud on VMware and for certain guest operating systems, users can configure cores per socket for virtual CPUs to take greater advantage of physical processing power. 

By default the cores per socket attribute is not set and the default is one core per socket. This means that 1 virtual CPU uses 1 physical core (and one CPU socket), even if more cores are available.

Set Cores per Socket

Changes to cores per socket take effect as follows:

  • If you edit a template, the change will apply to all VMs created from the template after the change is made.
  • If you edit a VM, the change will apply after the reconfigure is completed.

API Example of Set Cores per Socket

To set cores per socket of a VM template with the Abiquo API:

  1. Get a VM template. See https://wiki.abiquo.com/api/latest/VirtualMachineTemplatesResource.html#get-a-virtual-machine-template
  2. Edit the resulting VM template, for example:
    1. Change "cpuRequired" : 1  to "cpuRequired" : 8
    2. Add the attribute: "coresPerSocket" : 4
      • This is an optional attribute that is not present in the example
  3. Update the VM template with a put request. The put request will return the resulting template.
    See https://wiki.abiquo.com/api/latest/VirtualMachineTemplatesResource.html#update-a-virtual-machine-template

To set cores per socket for a VM, set the "cpu" attribute to a multiple of cores per socket.

Set Cores per socket in VM templates and VMs in the UI

  1. Set the total number of cores in the GUI by changing the # CPU field, (like "cpu" and "cpuRequired" in the API).
    1. It must be a multiple of the cores per socket
    2. The minimum value must be the number of cores per socket, because the VM requires at least one socket
    3. Template Min CPU and Max CPU should also be multiples of cores per socket
  2. Set the cores per socket.

Screenshot: Set cores per socket in VM templates

Privilege: Manage VM templates from Apps library


Screenshot: Set cores per socket in VMs

Privilege: Edit virtual appliance details


Troubleshooting

Check the following:

  • Your hypervisor will have a limit on the number of cores per socket, depending on the hypervisor version and license.
  • If an error displays that the total number of cores is not divisible by the cores When you set the cores per socket, check that you also
    • Set the total number of vCPUs to a multiple of the cores per socket
    • Set enough cores to fill at least one socket.
    Otherwise, your request may fail with a message that the total number of cores is not divisible by the cores per socket.

Copyright © 2006-2022, Abiquo Holdings SL. All rights reserved