Updated on 2024-11-14 GMT+08:00

Enabling or Disabling Hyper-Threading

Scenarios

When purchasing an x86 ECS, you can enable or disable hyper-threading by specifying CPU options. If you do not specify it, hyper-threading is enabled by default.

When you purchase x86 ECSs, you can determine whether to enable hyper-threading based on your service scenarios:
  • If you require CPU cores to concurrently process a large amount of data and background tasks, enabling hyper-threading can greatly improve computing performance.
  • For compute-intensive or high-performance computing (HPC) applications, such as computational materials science, disabling hyper-threading is a better choice.

You can enable or disable hyper-threading when purchasing x86 ECSs or modifying their specifications.

Background

The processors of x86 ECSs support hyper-threading, which enables two threads to run concurrently on each CPU core. Each thread is represented as a virtual CPU (vCPU). A vCPU is a virtual logical core. After hyper-threading is enabled, a CPU core contains two vCPUs.

A flavor defines the number of vCPUs. You can query the number of vCPUs that an x86 ECS has by referring to Querying the Number of vCPUs of an ECS.

Hyper-threading is enabled for most x86 ECSs by default. If hyper-threading is disabled during the x86 ECS creation or specification modification, the number of vCPUs queried from the x86 ECS is half of the number of vCPUs defined by the ECS flavor.

Notes and Constraints

  • After an x86 ECS is purchased, you cannot directly change its hyper-threading status. To do so, you can change its flavor to change the hyper-threading status.
  • Enabling or disabling hyper-threading is free of charge.
  • For details about ECS flavors that support hyper-threading, see A Summary List of x86 ECS Specifications.

Enabling or Disabling Hyper-Threading (During ECS Purchase)

  1. Log in to the management console and access the Buy ECS page.

    Configure basic, network, and advanced settings for ECSs based on service requirements. For details, see Purchasing an ECS.

  2. Select Configure now to configure advanced options.
  3. Select Specify CPU options.
  4. Set Threads per Core.
    This parameter is displayed when Specify CPU options is selected. You can select a parameter value from the drop-down list.
    • 1: one thread per core, which means hyper-threading is disabled.
    • 2 (default value): two threads per core, which means hyper-threading is enabled.
  5. Click Next: Confirm to confirm the settings and complete the ECS purchase.

    After purchasing an ECS, you can query the hyper-threading status by referring to the cpu_options parameter in Querying Details About an ECS.

Enabling or Disabling Hyper-Threading (During ECS Flavor Change)

  1. Log in to the management console.
  2. Click in the upper left corner and select your region and project.
  3. Click . Under Compute, click Elastic Cloud Server.
  4. On the Elastic Cloud Server page, locate the row containing the target ECS and choose More > Modify Specifications in the Operation column.

    The Modify ECS Specifications page is displayed.

  5. Select a new ECS type and flavor.
  6. Click Next.
  7. Confirm the settings, read and select the agreement, and then click Submit Application.

    After modifying ECS specifications, you can query the hyper-threading status by referring to the cpu_options parameter in Querying Details About an ECS.

Querying the Number of vCPUs of an ECS

You can log in to an ECS and view the number of its vCPUs.

  • For Linux ECSs:
    1. Log in to a Linux ECS.
    2. Run the following command to view the number of logical cores of the ECS:

      lscpu

      As shown in Figure 1, CPU(s) indicates the number of logical cores.

      Figure 1 Viewing the result
  • For Windows ECSs:
    1. Log in to a Windows ECS.
    2. Choose Control Panel > Device Manager and expand Processors to view the number of logical cores (threads) of the ECS.
      Figure 2 Viewing the result