In most scenarios, if you do not require special Elastic Compute Service (ECS) instance types such as GPU-accelerated ECS instance types and ECS instance types with local disks, we recommend that you specify vCPU and memory specifications to create elastic container instances. In this case, you can further specify a compute category. For example, if you want to use a pod that has 0.25 to 8 vCPUs in a simple application scenario, you can set the compute category to economy to reduce the cost. If you want the instance to have one or more vCPUs, you can set the compute category to general to obtain high performance.
Description of the compute category feature
To better meet your requirements for low cost or stable performance, Elastic Container Instance provides the compute category feature. When you create an elastic container instance by specifying vCPU and memory specifications, Elastic Container Instance selects an underlying architecture based on the economy and general compute categories. You can configure a compute category based on your requirements. The system automatically selects an underlying architecture that matches the vCPU and memory specifications.
Economy compute category
The economy compute category supports instances that have 0.25 to 8 vCPUs. The unit price of instances of the economy compute category is lower than the unit price of instances of the general compute category.
General compute category
The general compute category supports instances that have 1 to 64 vCPUs. The specification unit prices of instances of the general compute category are the same as the specification unit prices of instances that are created without the compute category feature enabled. Instances of the general compute category provide higher performance than instances with the same vCPU and memory specifications that are created without the compute category feature enabled.
How to select a compute category
You can select a compute category based on your specific preferences for low cost, stable performance, or high availability. We recommend that you select a compute category based on the following rules:
If you want to use the elastic container instance in simple applications, you can select the economy compute category to reduce resource costs.
If you want the elastic container instance to provide high performance, you can select the general compute category.
If your business can tolerate certain performance fluctuations, you can specify multiple compute categories to prevent instance creation failure due to insufficient resources and ensure high availability.
Description of the compute categories
This section describes the economy and general compute categories supported by Elastic Container Instance.
By default, the temporary storage space of instances of the economy and general compute category is 30 GiB.
Economy compute category
General compute category
Billing
The economy and general compute categories are in public preview.
Economy compute category
Compared with instances that are created without the compute category feature enabled, instances of the economy compute category are entitled to the same memory unit price and a lower vCPU unit price.
Unit price of vCPUs: USD 0.00000424 per vCPU-second (USD 0.015264 per vCPU-hour)
Unit price of the memory: USD 0.00000096 per GiB-second (USD 0.003456 per GiB-hour)
General compute category
The specification unit prices of instances of the general compute category are the same as the specification unit prices of elastic container instances that are created without the compute category feature enabled.
Unit price of vCPUs (number of vCPUs): USD 0.0000077/second (USD 0.02772/hour)
Unit price of memory (GiB): USD 0.00000096/second (USD 0.003456/hour)
After the elastic container instance is created, you can call the DescribeContainerGroups API operation to query the details of the instance. The ComputeCategory response parameter indicates the compute category of the instance. You are charged based on the specification unit prices of the corresponding compute category.
Limits
The following limits apply if you specify a compute category when you create elastic container instances:
This feature is valid only when you create elastic container instances by specifying vCPU and memory specifications.
If you specify ECS instance types when you create elastic container instances, the ECS instance types take precedence. In this case, you cannot specify a compute category.
This feature is not supported when you create preemptible elastic container instances.
If you set the instance category to preemptible and specify a compute category, the system reports an error. The error code is FeatureBasedConstraintConflict.
This feature is not supported when you create Arm-based elastic container instances.
If you set the CPU architecture of the instance to Arm and specify a compute category, the system reports an error. The error code is FeatureBasedConstraintConflict.
Configuration description
When you call the CreateContainerGroup API operation to create an elastic container instance, you can use the ComputeCategory parameter to specify the compute category of the instance in addition to specifying the vCPU and memory specifications of the instance.
You can use one of the following methods to specify the vCPU and memory specifications of the instance:
Method 1: Specify vCPU and memory specifications only at the container level. The system automatically adds up the numbers of vCPUs and the memory sizes of all containers to obtain the vCPU and memory specifications of the instance.
Method 2: Specify the vCPU and memory specifications at the instance level and configure the vCPU and memory specifications at the container level based on your requirements.
Method 3: Specify the vCPU and memory specifications at the instance level by using the InstanceType parameter.
The following table describes the parameters that you can use to specify the vCPU and memory specifications of the instance. For more information, see CreateContainerGroup.
Parameter | Type | Example | Description |
Cpu | number | 2.0 | The number of vCPUs that you want to allocate to the elastic container instance. |
Memory | number | 4.0 | The memory size of the instance. Unit: GiB. |
Container.N.Cpu | number | 0.5 | The number of vCPUs that you want to allocate to container N. |
Container.N.Memory | number | 1.0 | The memory size of container N. Unit: GiB. |
InstanceType | String | 2-4Gi | The specifications of the instance.
|
ComputeCategory | string[] | economy | The compute category of the instance. Valid values:
You can specify multiple compute categories. The system selects the type for the elastic container instance based on the specified order of the compute categories. |
Implementation rules
After you enable the compute category feature, the specifications and compute category of the elastic container instance are determined based on the following rules:
After the elastic container instance is created, you can call the DescribeContainerGroups API operation to query the details of the instance. The ComputeCategory response parameter indicates the compute category of the instance. You are charged based on the specification unit prices of the corresponding compute category.
How you configure the instance during instance creation | Actually created instance |
No vCPU and memory specifications are specified, but a compute category is specified. | An instance that has 2 vCPUs and 4 GiB of memory is created. The instance uses the specified compute category. |
vCPU and memory specifications and a compute category are specified, and the combination of conditions meets the specification requirements of elastic container instances. | An instance is created based on the specified conditions. |
The specified number of vCPUs is less than 1, but the specified compute category is general. | The conditions do not meet the specification requirements of elastic container instances. The system automatically adjusts the number of vCPUs to 1 to meet the requirements of the general compute category. |
The specified number of vCPUs is greater than 8, but the specified compute category is economy. | The conditions do not meet the specification requirements of elastic container instances. The system cannot automatically adjust the specification. An error is reported. |
vCPU and memory specifications and a compute category are specified. The specified number of vCPUs is within the vCPU specification range of the compute category, but does not meet the specification requirements of elastic container instances. | The system automatically adjusts the specifications of the instance based on the specifications supported by Elastic Container Instance. When the system adjusts the specifications of the instance, the system selects the most similar specifications supported by Elastic Container Instance, and the selected vCPU and memory specifications are higher than or equal to the specified vCPU and memory specifications. For example, if you set the vCPU and memory specifications to |
Multiple vCPU and memory specifications or multiple compute categories are specified. | The system selects instance specifications based on the following rules:
For example, if you set the vCPU and memory specifications to
Important Because instance specifications have a higher priority than compute categories, if multiple compute categories are specified and the specified vCPU and memory specifications do not meet the specification requirements of elastic container instances, the system considers all the compute categories and scales up the instance specifications to the most similar instance specifications. If the intended vCPU and memory specifications are not compatible with a given compute category, this compute category is not considered in the scheduling of the current vCPU and memory specifications. For example, if you set the vCPU and memory specifications to |
Sample configurations
Example 1: Specify the vCPU and memory specifications of each container and set the compute category to economy.
ContainerGroupName=test-category # Set the compute category to economy. ComputeCategory.1=economy # Specify the vCPU and memory specifications of each container Container.1.Cpu=1.0 Container.1.Memory=2.0 Container.1.Name=nginx Container.1.Image=registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.14.2
Example 2: Specify the vCPU and memory specifications of the instance and set the compute categories to general and economy in sequence.
ContainerGroupName=test-category # Specify the vCPU and memory specifications of the instance. Cpu=4.0 Memory=8.0 # Set the compute categories to general and economy in sequence. ComputeCategory.1=general ComputeCategory.2=economy # Configure the containers. Container.1.Name=nginx Container.1.Image=registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.14.2
Example 3: Specify multiple vCPU and memory specifications for the instance and set the compute category to general.
ContainerGroupName=test-category # Specify multiple vCPU and memory specifications for the instance. InstanceType=2-4Gi,4-8Gi # Set the compute category to general. ComputeCategory.1=general # Configure the containers. Container.1.Name=nginx Container.1.Image=registry-vpc.cn-hangzhou.aliyuncs.com/eci_open/nginx:1.14.2