VM Performance

If your business requires VMs to have certain characteristics, such as a stronger ability to compete for computing resources, you can achieve this by configuring the relevant VM settings provided by ZStack ZSphere.

You can set these configurations when creating a new VM or modify the settings of existing VMs. This section assumes that you have already created several VMs.

The relevant VM configurations include:

VM Resource Contention

ZStack ZSphere provides the following three configurations to enhance a virtual machine's resource contention capability:

CPU NUMA Binding Configuration

CPU NUMA binding configuration: CPU pinning assigns the virtual CPUs (vCPUs) of a virtual machine to specific physical CPUs (pCPUs) of the host, which improves VM performance.

If you encounter either of the following two business scenarios, consider using the CPU binding feature to enhance VM performance:
  • CPU-intensive small application scenario:

    CPU-intensive applications have a high demand for CPU resources. If numerous such applications run on VMs, it can lead to competition for CPU resources. CPU binding ensures each application runs on specific physical CPUs, thus avoiding resource contention and improving system performance.

  • Uneven pressure on multi-core CPU scenario:

    For cases where multiple applications concentrate on one or a few CPUs, you can manually adjust the load on each CPU through CPU binding, with changes taking effect immediately.

To configure CPU binding, follow these steps:
  1. On the target VM page, click Shut Down to power off the VM.
  2. Click Modify Configuration, then select Hardware Information > CPU > CPU NUMA Binding, choose between automatic intelligent binding or manual binding as needed:
    • Automatic Intelligent Binding: Binds the VM's vCPUs to pCPUs within pNUMA nodes in descending order of pNUMA node ID. When all pCPUs in a pNUMA node are bound by the VM's vCPUs, it will proceed to bind vCPUs to pCPUs in the next pNUMA node. If all pCPUs are bound but there are still unbound vCPUs, it will cycle back to the first bound pNUMA node to continue binding.
    • Manual Binding: Manually bind vCPUs to pCPUs according to the host's pNUMA topology, ensuring all vCPUs are bound.
      • A single vCPU can be bound to one or more pCPUs, and a single pCPU can be bound by one or more vCPUs, provided that all pCPUs bound to a single vCPU reside within the same pNUMA node.
      • Displays the average usage rate of each pCPU over the past 15 minutes to assist in selecting the optimal pCPU for binding.
    Note:
    • If you have set up CPU overcommitment, the number of vCPUs may exceed the number of pCPUs. In this case, it is recommended not to have more vCPUs than bound pCPUs, as this could significantly impact VM performance.
    • After binding the CPU NUMA, if you change the number of virtual machine CPU cores, the CPU NUMA binding will be automatically canceled.
  3. After clicking OK, the CPU NUMA binding will be completed. You can then click Power On to restart the VM.

EmulatorPin Configuration

EmulatorPin configuration: EmulatorPin assigns all other threads than virtual CPU (vCPU) threads and IO threads of a virtual machine to physical CPUs (pCPUs) of the host so that these threads run on assigned pCPUs.

If you encounter the following business scenario, consider using EmulatorPin:
  • Parallel multi-business scenario:

    In a scenario where multiple VMs run on a single host with different services on each VM, this can lead to varying degrees of resource consumption. EmulatorPin achieves isolation of primary service processes across different VMs by binding the QEMU main thread of each VM to specific pCPUs, ensuring relatively stable system performance.

To configure EmulatorPin binding, follow these steps:
  1. On the target VM page, click Actions > Advanced Settings > Modify Other Options, and select EmulatorPin: bind the threads other than vCPU and IO threads in the VM to the host's pCPUs according to the host's pNUMA structure.
  2. After clicking OK, the EmulatorPin binding will be completed.

Configure CPU and Memory Resource Priorities

If Virtual Machine A shares the CPU and memory resources of Host A with other virtual machines, and its business importance and priority are higher than those of other virtual machines. In scenarios where resources are tight, such as when the host's load rate is too high, these virtual machines may compete for host resources. In this case, you can set the CPU resource priority and memory resource priority of Virtual Machine A to High, while others remain at Normal, to enhance Virtual Machine A's capability to acquire resources.

To configure resource priority, follow these steps:
  1. In the target virtual machine page, click Modify Configuration, then choose Hardware Information > CPU > CPU Resource Priority.
  2. Click OK to complete configuration.

VM CPU

ZStack ZSphere provides CPU mode configuration functionality, which you can use to set the virtual machine's CPU model to match the host's CPU model. This allows the virtual machine to inherit some or all of the host's CPU features, meeting specific business requirements.

Introduction to Virtual Machine CPU Modes

ZStack ZSphere supports the following CPU mode settings:

  • None (Default): The virtual machine's CPU model is emulated by QEMU, inheriting a limited set of features from the host CPU. This mode is recommended for migration scenarios.
  • Compatible: The virtual machine's CPU model closely matches or is identical to the host CPU model, for example, both showing as Haswell Intel CPUs. Compared to the None mode, this mode allows the virtual machine to inherit more features from the host CPU and can be used in migration scenarios. Note that this setting is not supported on aarch architecture clusters and virtual machines.
  • Passthrough: The virtual machine's CPU model is identical to the host CPU model. Additionally, the virtual machine inherits all CPU features from the host, such as extended page tables, large memory pages, and virtualization support. Compared to None, Compatibility, and Custom modes, this mode inherits the most features from the host CPU and is suitable for business scenarios with higher requirements for virtual machine functionality.
  • Custom (a specific CPU model): The virtual machine is configured with the specified custom CPU model. After configuring a custom CPU model, the virtual machine may have different CPU features compared to its previous configuration.

Configuring Virtual Machine CPU Mode

ZStack ZSphere offers configuration settings at both the virtual machine level and the cluster level. The precedence order for these settings is: virtual machine level > cluster level. This section describes how to configure the CPU mode for a single virtual machine:
  1. In the target virtual machine page, click the Shut Down button to power off the virtual machine.
  2. Click Modify Configuration, then choose Hardware Information > CPU > CPU Mode. Select the desired CPU mode according to your needs.
  3. Click OK to complete the CPU mode configuration. You can then click the Power On button to restart the virtual machine.

VM QoS

QoS (Quality of Service) resolves issues such as network latency and congestion by setting IO bandwidth thresholds. When the network is overloaded or congested, QoS ensures that traffic is not delayed or dropped, maintaining efficient network operation.

You can set QoS to limit disk bandwidth and inbound and outbound network bandwidth, ensuring that IO bandwidth does not exceed the set threshold. If you do not configure QoS, there will be no restrictions on IO bandwidth. This section primarily describes how to set up disk QoS and network QoS:

Configure Disk QoS

To set up disk QoS, follow these steps:
  1. In the target virtual machine page, click Modify Configuration, then choose Hardware Information > Disk {$n} > QoS. Turn on the QoS switch to configure QoS for disk n (for example, Disk 1).
    Disk QoS supports configuring bandwidth limits and IOPS limits. After turning on the switch, you must configure at least one of these limits:
    • Bandwidth Limit: Set the upper limit of read/write speed per second for the disk. Basic units include MB/s and GB/s. It is recommended not to set this value too low to avoid abnormal operation of the virtual machine.
      • Total Speed: Set the upper limit of total read/write speed for the disk.
      • Read/Write Speed: Set separate upper limits for read speed and write speed.
    • IOPS Limit: Set the upper limit of read/write operations per second for the disk.
      • Total IOPS: Set the upper limit of total read/write IOPS for the disk.
      • Read/Write IOPS: Set separate upper limits for read IOPS and write IOPS.
  2. Click OK to complete the disk QoS configuration.

Configure Network QoS

To configure network QoS, follow these steps:
  1. In the target virtual machine page, click Modify Configuration, then choose Hardware Information > NIC {$n} > QoS. Turn on the QoS switch to configure QoS for NIC n (for example, NIC 1).
    QoS supports configuring outbound and inbound bandwidth limits. Basic units include Kbps, Mbps, and Gbps. After turning on the switch, you must configure at least one of these bandwidth limits:
    • Transmit Bandwidth: The upper limit of upload bandwidth from the virtual machine.
    • Receive Bandwidth: The upper limit of download bandwidth to the virtual machine.
  2. Click OK to complete the network QoS configuration.