All Products
Search
Document Center

:Specify CPU options

Last Updated:Feb 26, 2024

The CPU options of an elastic container instance include the number of physical CPU cores and the number of threads per core. Elastic container instances may support or not support CPU options based on how the instances are created.

Description

Elastic Container Instance allows two threads to concurrently run on a single physical core, based on Intel Hyper-Threading (HT) technology. Each thread can be considered as a vCPU. You can use the following formula to calculate the number of vCPUs: Number of vCPUs = Number of physical CPU cores × Number of threads per core.

The following table describes the CPU options of an elastic container instance, which are the number of physical CPU cores and the number of threads per core. Elastic container instances may support or not support custom CPU options. This is determined based on how the instances are created.

Note

You can specify CPU options at no additional costs.

CPU option

Description

Scenario

Number of physical CPU cores

Specifies the number of physical CPU cores to use.

You can specify a smaller number of physical CPU cores to decrease the number of vCPUs, improve the CPU-to-memory ratio, and reduce the number of billable items and software license costs.

Number of threads per core

Specifies the number of threads per core to enable or disable HT on the CPU.

By default, Elastic Compute Service (ECS) instance types that support custom CPU options have HT enabled for common workloads. In this case, the number of threads per core is not 1. You can disable HT in the following scenarios:

  • Some high-performance computing (HPC) scenarios. In these scenarios, you can improve the performance of instances by disabling HT.

  • Memory-intensive business scenarios. You can disable HT to decrease the number of vCPUs, improve the CPU-to-memory ratio, and reduce the number of billable items and software license costs.

You can specify CPU options only when you create elastic container instances by specifying ECS instance types. If the system is using an ECS instance type that supports custom CPU options, the created elastic container instances also support custom CPU options.

Note

Only some ECS instance types support custom CPU options, and HT is enabled on instances of these instance types by default. For more information, see the Limits section of the Specify and view CPU options topic.

  • One ECS instance type is specified.

    • If the specified ECS instance type supports custom CPU options, elastic container instances are created with the custom CPU options based on the ECS instance type.

    • If the specified ECS instance type does not support custom CPU options, elastic container instances are created based on the ECS instance type while the settings of CPU options are ignored. Then, an event notification is sent to you. If the custom CPU options are invalid, elastic container instances cannot be created and an error message is sent to you.

  • Multiple ECS specifications are specified.

    The system tries the ECS instance types in the order that they are specified to create elastic container instances.

    • If the system is using an ECS instance type that supports custom CPU options, elastic container instances are created with the custom CPU options based on the ECS instance type.

    • If the system is using an ECS instance type that does not support custom CPU options or if the custom CPU options are invalid, elastic container instances are created based on the ECS instance type while the settings of CPU options are ignored. Then, an event notification is sent to you.

Configurations

Note

You can specify ECS instance types by calling API operations only.

When you call the CreateContainerGroup operation to create an elastic container instance, you can use the CpuOptionsCore and CpuOptionsThreadsPerCore parameters to customize CPU options. The following table describes these parameters. For more information, see CreateContainerGroup.

Parameter

Type

Example

Description

CpuOptionsCore

Integer

2

The number of physical CPU cores. You can specify this parameter for only specific ECS instance types.

CpuOptionsThreadsPerCore

Integer

2

The number of threads per core. You can specify this parameter for only specific ECS instance types. If the CpuOptionsThreadPerCore parameter is set to 1, HT is disabled.